qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.6k stars 3.01k forks source link

Python error:RuntimeError: wrapped C/C++ object of type SnapGeometriesToLayer has been deleted #24757

Closed qgib closed 6 years ago

qgib commented 7 years ago

Author Name: Etienne Trimaille (@Gustry) Original Redmine Issue: 16858 Affected QGIS version: master Redmine category:processing/qgis Assignee: Nyall Dawson


While trying to launch the "Snap geometries to layer" in the processing toolbox, I got this python exception:

An error has occurred while executing Python code: 

RuntimeError: wrapped C/C++ object of type SnapGeometriesToLayer has been deleted 
Traceback (most recent call last):
  File "/Users/etienne/dev/c/build-QGIS-testing-creator/output/python/plugins/processing/algs/qgis/QgisAlgorithm.py", line 39, in shortHelpString
    return shortHelp.get(self.id(), None)
RuntimeError: wrapped C/C++ object of type SnapGeometriesToLayer has been deleted

Python version: 3.6.1 (default, Mar 23 2017, 16:49:06) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] 
QGIS version: 2.99.0-Master Master, exported 

Python Path:
/Users/etienne/dev/c/build-QGIS-testing-creator/output/python/plugins/processing
/Users/etienne/dev/c/build-QGIS-testing-creator/output/python
/Users/etienne/.qgis3/python
/Users/etienne/.qgis3/python/plugins
/Users/etienne/dev/c/build-QGIS-testing-creator/output/python/plugins
/Users/etienne/dev/c/build-QGIS-testing-creator/output/bin/$PYTHONPATH
/usr/local/opt/gdal2-python/lib/python3.6/site-packages
/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python36.zip
/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6
/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload
/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
/Users/etienne/.qgis3//python

I compiled QGIS today.

qgib commented 7 years ago

Author Name: Etienne Trimaille (@Gustry)


Hum, I have this error with every QGIS algorithms :

RuntimeError: wrapped C/C++ object of type GridPolygon has been deleted 
Traceback (most recent call last):
  File "/Users/etienne/dev/c/build-QGIS-testing-creator/output/python/plugins/processing/algs/qgis/QgisAlgorithm.py", line 39, in shortHelpString
    return shortHelp.get(self.id(), None)
RuntimeError: wrapped C/C++ object of type GridPolygon has been deleted
qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


Etienne Trimaille wrote:

Hum, I have this error with every QGIS algorithms :

[...]

Nyall is working heavily on Processing in master, if there is a specific issue now on macOS I would let him know.


qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


Confirmed also on Windows. There are tools that just show the error message and other that show it but also open the tool dialog.

example:

Traceback (most recent call last): File "C:/OSGEO4~1/apps/qgis-dev/./python/plugins\processing\algs\qgis\QgisAlgorithm.py", line 39, in shortHelpString return shortHelp.get(self.id(), None) RuntimeError: wrapped C/C++ object of type ImportIntoPostGIS has been deleted


qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


seen the same also on Linux.

qgib commented 7 years ago

Author Name: Alexander Bruy (@alexbruy)


This is known issue and we are working on it

qgib commented 7 years ago

Author Name: Nyall Dawson (@nyalldawson)


Fixed by 383422f069f9d067eef967abddf01e3da6a1167a


qgib commented 7 years ago

Author Name: Etienne Trimaille (@Gustry)


I got the issue again:

An error has occurred while executing Python code: 

RuntimeError: wrapped C/C++ object of type QgsProcessingParameterCrs has been deleted 
Traceback (most recent call last):
  File "/Users/etienne/dev/cpp/build-QGIS-QGIS_Build_Kit_QT5-Debug/output/python/plugins/processing/modeler/ModelerGraphicItem.py", line 428, in mousePressEvent
    self.action()
  File "/Users/etienne/dev/cpp/build-QGIS-QGIS_Build_Kit_QT5-Debug/output/python/plugins/processing/modeler/ModelerGraphicItem.py", line 201, in editElement
    self.element.setParameterName(dlg.param.name())
RuntimeError: wrapped C/C++ object of type QgsProcessingParameterCrs has been deleted

Python version: 3.6.2 (default, Jul 17 2017, 16:44:45) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] 
QGIS version: 2.99.0-Master Master, 3412afc400 

I could replicate most of the time, not always: In the Processing modeler, create a new input parameter, close it, edit it and close it again. I can check how to replicate if needed


qgib commented 7 years ago

Author Name: Nyall Dawson (@nyalldawson)


I could replicate most of the time, not always: In the Processing modeler, create a new input parameter, close it, edit it and close it again. I can check how to replicate if needed

Can't reproduce - can you post step by step instructions please! (also commit sha for your build)


qgib commented 7 years ago

Author Name: Nyall Dawson (@nyalldawson)


Reproduced - it's when you close the dialog via the title bar close button, instead of using ok or cancel

qgib commented 7 years ago

Author Name: Nyall Dawson (@nyalldawson)


Applied in changeset 370b26798f459e4aabea8a174346b13b3f90b8ea.


qgib commented 7 years ago

Author Name: Etienne Trimaille (@Gustry)


Thanks Nyall for the quick fix. I will check again.

qgib commented 7 years ago

Author Name: Etienne Trimaille (@Gustry)


The problem occurs again for me in the modeler.

Steps to reproduce:



Maybe when we click on the close button, a popup should come to ask if we want to cancel the algorithm or if we just want to close the dialog and the model should still run in the background?

Latest commit from master

---

-  status_id  was changed from   Closed   to Reopened 
-  assigned_to_id  was changed from   Victor Olaya   to Nyall Dawson 
qgib commented 6 years ago

Author Name: Nyall Dawson (@nyalldawson)


Applied in changeset 87c1986c4b11701f19bba7d90c1be33d91d64b5f.


qgib commented 6 years ago

Author Name: Etienne Trimaille (@Gustry)


The problem occurs again! sorry. A fresh build from this morning: d7e18131808c3a622e5597cdf5608a28136755e7

New scenario: In "Settings" "Options" "Processing" "Providers" and then toggle the activate on/off checkbox (saga, grass ...) then press OK. It seems the error is coming from ALL plugins having their own providers:

An error has occurred while executing Python code: 

RuntimeError: wrapped C/C++ object of type QueryFactoryAlgorithm has been deleted 
Traceback (most recent call last):
  File "/Users/etienne/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/QuickOSM/src/quick_osm_processing/quick_osm_provider.py", line 74, in loadAlgorithms
    self.addAlgorithm(alg)
RuntimeError: wrapped C/C++ object of type QueryFactoryAlgorithm has been deleted

Thanks for previous fix.


qgib commented 6 years ago

Author Name: Nyall Dawson (@nyalldawson)


I can't reproduce - is it still an issue?


qgib commented 6 years ago

Author Name: Etienne Trimaille (@Gustry)


Yes, I can replicate on master.

Maybe it's not with all Processing plugins. The first message I have, it's coming from the "Buffer by percentage" plugin.

RuntimeError: wrapped C/C++ object of type BufferByFixedPercentage has been deleted 
Traceback (most recent call last):
  File "/Users/etienne/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/BufferByPercentage/bufferbypercentage.py", line 136, in loadAlgorithms
    self.addAlgorithm(alg)
RuntimeError: wrapped C/C++ object of type BufferByFixedPercentage has been deleted

Then after this error message, I have the same error but from my own plugin QuickOSM.

qgib commented 6 years ago

Author Name: Nyall Dawson (@nyalldawson)


Not a QGIS bug - it's a bug in the plugin. PR here: https://github.com/jdugge/BufferByPercentage/pull/14


qgib commented 6 years ago

Author Name: Johannes Kroeger (Johannes Kroeger)


I just had this happen with https://github.com/root676/QNEAT3/issues/8

Is there no way to catch these? I feel that no plugin should be able to completely crash QGIS. :(