jorgealmerio / valuetool

QGis plugin to display in a table or plot the values from the visible raster layers at the current mouse position
4 stars 7 forks source link

RuntimeError: wrapped C/C++ object of type QgsRasterLayer has been deleted #4

Closed AlisterH closed 4 years ago

AlisterH commented 4 years ago

It would be good to handle this error. Workaround when being flooded with it is to turn valuetool off and then on again:


2020-05-19T08:39:46     WARNING    Traceback (most recent call last):
              File "C:/Users/alister/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\valuetool\valuewidget.py", line 265, in printValue
              layers = self.activeRasterLayers()
              File "C:/Users/alister/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\valuetool\valuewidget.py", line 230, in activeRasterLayers
              if layer!=None and layer.isValid() and \
             RuntimeError: wrapped C/C++ object of type QgsRasterLayer has been deleted
jorgealmerio commented 4 years ago

Hi, I removed (commented) line 511 of 'valuetoolwidiget.py' file to force reload layer list when close/open projects to prevent this error. Please update the plugin to version 3.0.3 Tell me if the error persists! Thank you for help.

AlisterH commented 4 years ago

Sorry, not fixed. It occurs if using "selected layers" in valuetool when the layer is removed from the project. I think it requires a try/except.

jorgealmerio commented 4 years ago

I gived up and followed your advice! I used a "try except" block. Let me know if version 3.0.4 is ok. Thanks!

AlisterH commented 4 years ago

Yes, fixed.