Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash QGIS 2.10.1 after select MultiGeometry features from PostGIS into Temporary Layer #21366

Closed
qgib opened this issue Sep 1, 2015 · 11 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption

Comments

@qgib
Copy link
Contributor

qgib commented Sep 1, 2015

Author Name: Evgeniy Z (Evgeniy Z)
Original Redmine Issue: 13308
Affected QGIS version: 2.10.1


I have created a plugin which selects objects from a PostGIS table by rectangle and puts it into new Memory Layer. Type of geometry in PostGis table - MultiLineString. Adding features to the Memory Layer (its type also MultiLineString) is done successfully. But if you try zoom to Layer and perform any manipulations with map, QGIS is going to crash.
This situation occurs in QGIS 2.10. In 2.8.2 it worked well. Therefore I tried to convert MultiLineString to LineString - QGIS does not crashs, but it is unacceptable for work with some data...

Below is the example code for QGIS python console to reproduce situation and shapefile with some geometry data for tests.

Steps for reproduce:

  1. Load shapefile into PostGIS base;
  2. Paste code to console, editing parameters for connections. (It will create new memory layer "Result_Layer" and put to it data from PostGIS table "test_shape");
  3. Press "Zoom to Layer" to see geometry. (Now we see, that all features have been added);
  4. try Zoom In, Zoom Out, Pan map or some any manipulation with map extent in "Result_Layer" area.
  5. QGIS CRASH.
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from PyQt4.QtSql import *

self = qgis.utils
uri = QgsDataSourceURI()
uri.setConnection("10.1.1.6", "5432", "Database", "Username", "Password")
 # "test shape" - Our layer name in base after import from shapefile.
 # "public" - schema
uri.setDataSource("public", "test_shape", "geom", "", "gid")
vlayer=QgsVectorLayer(uri.uri(), "tot", "postgres")
        
resultl = QgsVectorLayer("MultiLineString", "Result_select", "memory")
QgsMapLayerRegistry.instance().addMapLayer(resultl, True)
resultpr = resultl.dataProvider()
for feature in vlayer.getFeatures():
            resultpr.addFeatures([feature])

self.iface.mapCanvas().refresh()
print 'done'


@qgib
Copy link
Contributor Author

qgib commented Sep 7, 2015

Author Name: Salvatore Larosa (@slarosa)


I am not able to reproduce the crash in master version.

Which platform are you using?
Have you tried to reproduce the crash with all plugins deactivated (option --noplugins)?


  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Sep 7, 2015

Author Name: Evgeniy Z (Evgeniy Z)


I am using Windows 7 x64, Windows 10 x32.
Now I tried to reproduce the crash with all plugins deactivated - also crash.

@qgib
Copy link
Contributor Author

qgib commented Sep 7, 2015

Author Name: Evgeniy Z (Evgeniy Z)


Demonstration


  • 9040 was configured as Crash.avi

@qgib
Copy link
Contributor Author

qgib commented Sep 7, 2015

Author Name: Salvatore Larosa (@slarosa)


I can confirm it on Windows and I also can confirm it works fine in LTR version.


  • status_id was changed from Feedback to Open

@qgib
Copy link
Contributor Author

qgib commented Sep 14, 2015

Author Name: Mauricio van den Berg (Mauricio van den Berg)


I suspect I ran into something caused by the same problem.

Reproducible in the following way:

  1. Add multilinestring:
@MLayer = QgsVectorLayer("MultiLineString?crs=epsg:28992", "test", "memory")
MLayer.startEditing()
fet = QgsFeature() 
geomstring = "MULTILINESTRING((166837.841 577100.866,166836.905 577101.214),(166835.031 577101.913,166834.094 577102.262))"
fet.setGeometry(QgsGeometry.fromWkt(geomstring))
MLayer.dataProvider().addFeatures( [fet] ) 
MLayer.commitChanges()
MLayer.updateExtents()
QgsMapLayerRegistry.instance().addMapLayer(MLayer)

  1. Zoom out very far
  2. Click "zoom to layer" on newly added layer
  3. Crash

Also crashes in less easily reproducible ways.

I'm also on QGIS 2.10.1, Windows 7 x64

@qgib
Copy link
Contributor Author

qgib commented Oct 5, 2015

Author Name: Jürgen Fischer (@jef-n)


  • assigned_to_id was configured as Jürgen Fischer

@qgib
Copy link
Contributor Author

qgib commented Oct 5, 2015

Author Name: Jürgen Fischer (@jef-n)


Original problem only reproducable with 2.10.1 (windows 64bit; second example doesn't crash there here either). 2.8.3 and master seem to work fine. Does enabling/disabling geometry simplification on the layer make a difference?


  • status_id was changed from Open to Feedback
  • assigned_to_id removed Jürgen Fischer

@qgib
Copy link
Contributor Author

qgib commented Oct 6, 2015

Author Name: Evgeniy Z (Evgeniy Z)


Jürgen Fischer, No, enabling/disabling geometry simplification on the layer does not make a difference.

@qgib
Copy link
Contributor Author

qgib commented Oct 9, 2015

Author Name: Jürgen Fischer (@jef-n)


Evgeniy Z wrote:

No, enabling/disabling geometry simplification on the layer does not make a difference.

Can you reproduce it in master?

@qgib
Copy link
Contributor Author

qgib commented Oct 9, 2015

Author Name: Evgeniy Z (Evgeniy Z)


So in 2.11 master it seems works normal. But I could not track one unexpected crash. I was limited in time.

@qgib
Copy link
Contributor Author

qgib commented Oct 21, 2015

Author Name: Nyall Dawson (@nyalldawson)


Not reproducible in master. Please reopen if you experience this with 2.12


  • resolution was changed from to fixed/implemented
  • status_id was changed from Feedback to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption labels May 25, 2019
@qgib qgib closed this as completed May 25, 2019
troopa81 pushed a commit to troopa81/QGIS that referenced this issue Jun 24, 2019
Was incorrectly truncating at first ']' character

Fixes qgis#21366

(cherry picked from commit cab2dcf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption
Projects
None yet
Development

No branches or pull requests

1 participant