Opened 15 years ago
Closed 14 years ago
#1900 closed bug (fixed)
Qgis crashes after closing a GRASS mapset and removing a GRASS layer from the legend
Reported by: | lutra | Owned by: | rugginoso |
---|---|---|---|
Priority: | critical: causes crash or data corruption | Milestone: | Version 1.5.0 |
Component: | GRASS | Version: | Trunk |
Keywords: | Cc: | pcav, rblazek | |
Must Fix for Release: | Yes | Platform: | All |
Platform Version: | Awaiting user input: | no |
Description
I can see the following behaviour with some data (the qgis sample dataset for example). I'm using qgis dev version (1.3) installed via osgeo4w.
To replicate do the following:
*) open the qgis sample (GRASS) dataset
*) add a vector layer
*) close the GRASS mapset (without removing the GRASS vector layer)
*) close qgis (file -> exit)
it is first thrown a warning "variable LOCATION_NAME not set" that appears also under linux, but then under windows the program crashes. See attached image.
Not really sure to what component assign this ticket.
Attachments (1)
Change History (13)
by , 15 years ago
Attachment: | Screenshot.jpg added |
---|
follow-up: 2 comment:1 by , 15 years ago
follow-up: 3 comment:2 by , 15 years ago
Replying to jef:
not reproducable here using the spearfish dataset.
Hi,
yes, it doesn't happen with all GRASS mapsets, but i found a few ones that lead qgis to this behavior. Try for example the qgis sample dataset, where you can find a GRASS mapset.
comment:3 by , 15 years ago
Replying to lutra:
Replying to jef:
not reproducable here using the spearfish dataset.
Hi,
yes, it doesn't happen with all GRASS mapsets, but i found a few ones that lead qgis to this behavior. Try for example the qgis sample dataset, where you can find a GRASS mapset.
The patch in #1878 should fix this - please test.
follow-up: 5 comment:4 by , 15 years ago
Hi,
if I apply the patch I get the following error while compiling.
By the way I cannot compile under windows, so it would be hard in any case to say if the crash is gone or not.
In file included from /home/gio/Desktop/qgis_unstable/src/providers/grass/qgsgrassprovider.cpp:19: /home/gio/Desktop/qgis_unstable/src/providers/grass/qgsgrass.h: In constructor ‘QgsGrass::Exception::Exception(const char*)’: /home/gio/Desktop/qgis_unstable/src/providers/grass/qgsgrass.h:37: error: no matching function for call to ‘std::exception::exception(const char*&)’ /usr/include/c++/4.3/exception:59: note: candidates are: std::exception::exception() /usr/include/c++/4.3/exception:57: note: std::exception::exception(const std::exception&) make[2]: *** [src/providers/grass/CMakeFiles/qgisgrass.dir/qgsgrassprovider.o] Error 1 make[1]: *** [src/providers/grass/CMakeFiles/qgisgrass.dir/all] Error 2 make: *** [all] Error 2
follow-up: 6 comment:5 by , 15 years ago
Replying to lutra:
if I apply the patch I get the following error while compiling.
fixed - patch replaced.
comment:6 by , 15 years ago
Replying to jef:
fixed - patch replaced.
Hi Jurgen, the patch under linux works, the warning message is gone. If the warning message is the source for the crash under windows, then the problem should be fixed.
Thanks.
comment:9 by , 15 years ago
Milestone: | Version 1.3.0 → Version 1.4.0 |
---|---|
Platform: | Windows → Unix |
Resolution: | fixed |
Status: | closed → reopened |
Summary: | windows: qgis crashes after closing a GRASS mapset → Qgis crashes after closing a GRASS mapset |
Type: | patch → bug |
I have to reopen this ticket because I'm seeing this behaviour again (under Ubuntu 9.04, both qgis 1.3 from repo and 1.4 trunk).
Open a GRASS mapset, add a layer, close the mapset, remove the layer from legend -> qgis crashes
terminate called after throwing an instance of 'QgsGrass::Exception' what(): G_getenv(): Variable LOCATION_NAME not set Aborted
comment:10 by , 14 years ago
Component: | Data Provider → GRASS |
---|
comment:11 by , 14 years ago
Cc: | removed |
---|---|
Must Fix for Release: | No → Yes |
Owner: | changed from | to
Platform: | Unix → All |
Status: | reopened → new |
Summary: | Qgis crashes after closing a GRASS mapset → Qgis crashes after closing a GRASS mapset and removing a GRASS layer from the legend |
comment:12 by , 14 years ago
Cc: | added |
---|---|
Resolution: | → fixed |
Status: | new → closed |
There are 2 problems here:
1) Bug in GDAL GRASS provider (http://trac.osgeo.org/gdal/ticket/3313), if MAPSET is unset, the next attempt to read GRASS raster data results in GRASS fatal error. I have written a patch for GDAL (waiting for approval) and temporal fix for QGIS in changeset:12687.
2) Another proble is, how GRASS fatal errors are handled and that is quite interesting. It is possible to set a routine which handles GRASS errors with G_set_error_routine. The problem is, that both QGIS GRASS plugin and GDAL GRASS driver do it. GDAL sets Grass2CPLErrorHook while GRASS QgsGrass::error_routine. When an error happens in GDAL it does not call the Grass2CPLErrorHook but QgsGrass::error_routine because the routine was reset in the mean time by QGIS GRASS plugin. QgsGrass::error_routine throws QgsGrass::Exception but that is not caught by raster layer renderer (right, it is expecting error from GDAL) and thus qgis crashes. Isn't it nice!?
I don't know how to solve this at moment, but I close this bug as 1) is resolved and I create a new ticket for 2) : #2347
not reproducable here using the spearfish dataset.