#1480 closed bug (fixed)
Strange behavior of set default qml style for indexed rasters
Reported by: | gislab | Owned by: | ersts |
---|---|---|---|
Priority: | major: does not work as expected | Milestone: | |
Component: | Rasters | Version: | Trunk |
Keywords: | Cc: | warmerdam | |
Must Fix for Release: | No | Platform: | All |
Platform Version: | Awaiting user input: | no |
Description
- Load indexed raster
- Open properties
- Color table
- Change a couple of colors
- Save as default
- Ok
- Try to load the same raster or remove it and try to load it
Is it either not loaded (win) or crashes QGIS (linux)
tested on this raster: http://gis-lab.info/other/indexed-raster-topo1km.7z
Change History (5)
comment:1 by , 15 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 15 years ago
Cc: | added |
---|
comment:3 by , 15 years ago
This seems to also occur if setting raster transparency only and saving as a default.
comment:4 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I will let this sit in trunk for a couple of days before shifting over to the Vesion-1_0 branch so a little more testing can be done
Note:
See TracTickets
for help on using tickets.
I actually see several problems and I am surprised they have not come up before...
Part of the back trace:
First issue is that the load default styles call is being made before a raster layer is actually loaded and set_blah_BandName( ) makes a call to validateBandName() which check to see if the band name actually exists, but since a raster layer has not yet be loaded all validation requests will fail and any/all bands will be set to "Not Set", but that is not what causes the crash.
Second problem and a more important one is that the load default styles is returning false, which makes the constructor abort mid way, again before a valid layer is loaded. The loading of the raster layer is where the "isValid" variable gets set, which is not initialized before hand. So when default styles kicks back to the qgisapp.cpp around line 5107 is check to see if the raster layer is valid, if not the raster layer is delete. Because the variable is not initialized,sometime it is true and sometimes it is false which could explain why it sometimes crashes and sometimes does not. But the actual crash is the third problem.
The Third problem is that the in the deconstructor GDALClose is being called on the wrong pointer, which is not checked to see if it is null. This is what actually causes the crash, because if the raster layer has not been loaded, it going to be null.
Sorry for the long post, it is partially to help remember at a later date. I am sure there is going to be a quick release of small bug fixes shortly after v1.0.0 is released.