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

Error produced by closing algorithm dialogs: RuntimeError: wrapped C/C++ object of type QgsMapToolCapture has been deleted #53294

Closed
2 tasks done
AlisterH opened this issue May 31, 2023 · 2 comments · Fixed by #53357
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@AlisterH
Copy link
Contributor

AlisterH commented May 31, 2023

What is the bug or the crash?

An error message is produced when closing a processing algorithm dialog, if the map tool that was active before opening the dialog is no longer available.

  1. The user should not be routinely exposed to an error message like this.
  2. I don't think the underlying behaviour is right, anyway. Presumably the code that is doing this was introduced to deal with situations where the user has clicked on something in the algorithm dialog that changes the map tool, e.g. to specify coordinates for an algorithm input. This code should only be run if such a map tool is still active. It should not be run if the user has not clicked on something in the algorithm dialog that changes the map tool, or if they have, but the map tool has then changed back to something else.

Steps to reproduce the issue

  1. View>Elevation Profile
  2. Click "Capture curve" button:
    image
  3. Launch a processing algorithm dialog.
  4. Close the Elevation Profile panel.
  5. Close the algorithm dialog
  6. QGIS produces an error message:
2023-05-31T15:30:06     WARNING    Traceback (most recent call last):
              File "D:\OSGeo4W/apps/qgis-dev/./python/plugins\processing\ProcessingPlugin.py", line 406, in executeAlgorithm
              canvas.setMapTool(prevMapTool)
             RuntimeError: wrapped C/C++ object of type QgsMapToolCapture has been deleted```

### Versions

Tested in 3.30.2 and a fairly recent nightly.

QGIS version
3.30.2-'s-Hertogenbosch
QGIS code revision
0992b53
Qt version
5.15.3
Python version
3.9.5
GDAL/OGR version
3.7.0
PROJ version
9.2.0
EPSG Registry database version
v10.082 (2023-02-06)
GEOS version
3.11.2-CAPI-1.17.2
SQLite version
3.41.1
PDAL version
2.5.3
PostgreSQL client version
unknown
SpatiaLite version
5.0.1
QWT version
7.1.6
QScintilla2 version
2.13.1
OS version
Windows 10 Version 2009

Active Python plugins
annotationManager
0.5
annotation_labels
1.0.1
AnotherDXF2Shape
1.2.7
changeDataSource
3.1
civilplan
1.0
coveragebuilder
version 0.5.0
Equal_area_slope_QGIS_Plugin
0.1
file_management
0.1
FlowEstimator
0.21
geometry_paster
0.2
joinmultiplelines
Version 0.4.1
LayerBoard
1.0.1
layout_panel-main
0.3
MemoryLayerSaver
4.0.4
nominatim
1.4.5
pathfinder
version 0.4.2
plugin_reloader
0.9.3
precisioncursor4qgis-main
0.2E
QCopycanvas
0.7
qgis_resource_sharing
1.0.0
quick_map_services
0.19.33
StyleLoadSave
1.0
switch_active_layer
0.1
valuetool
3.0.15
workbench
0.0.4
db_manager
0.1.20
MetaSearch
0.3.6
processing
2.12.99
grassprovider
2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response

@AlisterH AlisterH added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label May 31, 2023
@nicogodet
Copy link
Member

Same when running alg from locator

RuntimeError: wrapped C/C++ object of type QgsMapToolCapture has been deleted 
Traceback (most recent call last):
  File "C:\OSGeo4W/apps/qgis-dev/./python/plugins\processing\gui\AlgorithmLocatorFilter.py", line 128, in triggerResult
    canvas.setMapTool(prevMapTool)
RuntimeError: wrapped C/C++ object of type QgsMapToolCapture has been deleted

@agiudiceandrea agiudiceandrea added the Processing Relating to QGIS Processing framework or individual Processing algorithms label May 31, 2023
@nicogodet
Copy link
Member

@alexbruy (For unknown reason, I can't comment on your PR...)

This pattern appears in other places :

canvas.setMapTool(prevMapTool)

canvas.setMapTool(prevMapTool)

nyalldawson pushed a commit that referenced this issue Jun 7, 2023
qgis-bot pushed a commit that referenced this issue Jun 7, 2023
alexbruy added a commit that referenced this issue Jun 8, 2023
…ports

[Backport queued_ltr_backports] do not raise error in processing algoirthm if map tool can not be restored  (fix #53294)
nyalldawson pushed a commit that referenced this issue Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants