Bug report #586
Qgis 0.8.0 Crash on opening existing project using PostGis layer
|Affected QGIS version:||Regression?:||No|
|Operating System:||Fedora||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||worksforme|
|Crashes QGIS or corrupts data:||Copied to github as #:||10645|
Crashes on opening an existing project with segmentation error after changing properties on layer in a previous session. Note the existing project was created with current qgis8.
Examination of the project file before and after changes shows that the password for the postgis access is dropped. Opening the project without changes, allows loading of the project.
<datasource>host=localhost dbname=shoalhaven port=5432 user=shoalhaven password= table=public.depthdata_qad (location) sql=</datasource>
Easy to replicate.
My version self compiled on Fedora 6, using qt4-4.2.2-1.fc6 and postgis 1.1.x
#1 Updated by john-floyd-dnr-nsw-gov-au - over 13 years ago
I think that the problem is due to the maplayer method publicSource, which removes the password=xxx out of the datasource URI, and if a change to the layer is made then this URI (minus the password=xxx is written to the project file! A solution is to either re gen the text version of the URI when collating the project file or create a copy of the URI for the publicSource method.
A better approach would be to forget about storing the text version and always regen the text version as required. (there is some comment about the duplication of the uri in different forms in the code)
#2 Updated by john-floyd-dnr-nsw-gov-au - over 13 years ago
It only occurs if you also view the Metadata Page of a postgis layer properties. You actually dont need to change anything! Just hit OK or Apply for the property window and then save the project. Password will disappear from the project file datasource entry for that layer! And on restarting, qgis will crash with a segmentaion error.
Q? The password parsing code should be made to handle the password= condition (that is nothing after the =) without crashing regardless.