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

Qgis crashes after closing a GRASS mapset and removing a GRASS layer from the legend #1887

Closed
qissue-bot opened this issue Mar 8, 2019 · 10 comments

Comments

@qissue-bot
Copy link
Owner


Author Name: Giovanni Manghi (Giovanni Manghi)
Original Redmine Issue: 1900, https://issues.qgis.org/issues/1900

Original Assignee: Lorenzo Masini


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.


@qissue-bot
Copy link
Owner Author


Original Redmine Comment
Author Name: Jürgen Fischer (Jürgen Fischer)
Original Date: 2009-08-26T10:42:38.000Z


not reproducable here using the spearfish dataset.

@qissue-bot
Copy link
Owner Author


Original Redmine Comment
Author Name: Giovanni Manghi (Giovanni Manghi)
Original Date: 2009-08-26T11:29:37.000Z


Replying to [comment:1 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.

@qissue-bot
Copy link
Owner Author


Original Redmine Comment
Author Name: Jürgen Fischer (Jürgen Fischer)
Original Date: 2009-08-26T14:21:54.000Z


Replying to [comment:2 lutra]:

Replying to [comment:1 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.

@qissue-bot
Copy link
Owner Author


Original Redmine Comment
Author Name: Giovanni Manghi (Giovanni Manghi)
Original Date: 2009-08-27T04:54:44.000Z


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&)


maker2: *** [src/providers/grass/CMakeFiles/qgisgrass.dir/qgsgrassprovider.o] Error 1
maker1: *** [src/providers/grass/CMakeFiles/qgisgrass.dir/all] Error 2
make: *** [all] Error 2

@qissue-bot
Copy link
Owner Author


Original Redmine Comment
Author Name: Jürgen Fischer (Jürgen Fischer)
Original Date: 2009-08-27T07:03:13.000Z


Replying to [comment:4 lutra]:

if I apply the patch I get the following error while compiling.

fixed - patch replaced.

@qissue-bot
Copy link
Owner Author


Original Redmine Comment
Author Name: Giovanni Manghi (Giovanni Manghi)
Original Date: 2009-08-27T11:33:48.000Z


Replying to [comment:5 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.

@qissue-bot
Copy link
Owner Author


Original Redmine Comment
Author Name: Giovanni Manghi (Giovanni Manghi)
Original Date: 2009-08-27T11:35:09.000Z


Applies the same patch of #1878

@qissue-bot
Copy link
Owner Author


Original Redmine Comment
Author Name: Jürgen Fischer (Jürgen Fischer)
Original Date: 2009-09-05T03:02:08.000Z


fixed in commit:43408110 (SVN r11561)

@qissue-bot
Copy link
Owner Author


Original Redmine Comment
Author Name: Giovanni Manghi (Giovanni Manghi)
Original Date: 2009-09-29T08:24:08.000Z


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

@qissue-bot
Copy link
Owner Author


Original Redmine Comment
Author Name: Redmine Admin (Redmine Admin)
Original Date: 2010-01-07T03:37:59.000Z


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment