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

Avoid recursion in crs validation #44349

Merged

Conversation

m-kuhn
Copy link
Member

@m-kuhn m-kuhn commented Jul 23, 2021

If some proj helper files are missing (likely proj.db), showing the
projection selection dialog is shown recursively. Avoid this.

Excerpt from a sample trace:

QgsMapLayer::setCrs :
QgsVectorLayer::setCoordinateSystem :
QgsVectorLayer::setDataSource :
QgsVectorLayer::QgsVectorLayer :
QgsCoordinateBoundsPreviewMapWidget::QgsCoordinateBoundsPreviewMapWidget :
QgsProjectionSelectionTreeWidget::setShowNoProjection :
QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget :
QgsProjectionSelectionDialog::setShowNoProjection :
QgsProjectionSelectionDialog::QgsProjectionSelectionDialog :
QgisApp::validateCrs :
QObject::qt_static_metacall :
QgisApp::customCrsValidation :
QgisApp::customProjection :
QgsMapLayer::setCrs :
QgsVectorLayer::setCoordinateSystem :
QgsVectorLayer::setDataSource :
QgsVectorLayer::QgsVectorLayer :
QgsCoordinateBoundsPreviewMapWidget::QgsCoordinateBoundsPreviewMapWidget :
QgsProjectionSelectionTreeWidget::setShowNoProjection :
QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget :
QgsProjectionSelectionDialog::setShowNoProjection :
QgsProjectionSelectionDialog::QgsProjectionSelectionDialog :
QgisApp::validateCrs :
QObject::qt_static_metacall :
QgisApp::customCrsValidation :
QgisApp::customProjection :
QgsMapLayer::setCrs :
QgsVectorLayer::setCoordinateSystem :
QgsVectorLayer::setDataSource :
QgsVectorLayer::QgsVectorLayer :
QgsCoordinateBoundsPreviewMapWidget::QgsCoordinateBoundsPreviewMapWidget :
QgsProjectionSelectionTreeWidget::setShowNoProjection :
QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget :
QgsProjectionSelectionDialog::setShowNoProjection :
QgsProjectionSelectionDialog::QgsProjectionSelectionDialog :
QgisApp::validateCrs :
QObject::qt_static_metacall :
QgisApp::customCrsValidation :
QgisApp::customProjection :
QgsMapLayer::setCrs :
QgsVectorLayer::setCoordinateSystem :
QgsVectorLayer::setDataSource :
QgsVectorLayer::QgsVectorLayer :
QgsCoordinateBoundsPreviewMapWidget::QgsCoordinateBoundsPreviewMapWidget :
QgsProjectionSelectionTreeWidget::setShowNoProjection :
QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget :
QgsProjectionSelectionDialog::setShowNoProjection :
QgsProjectionSelectionDialog::QgsProjectionSelectionDialog :
QgisApp::validateCrs :
QObject::qt_static_metacall :
QgisApp::customCrsValidation :

Description

[Replace this with some text explaining the rationale and details about this pull request]

If some proj helper files are missing (likely proj.db), showing the
projection selection dialog is shown recursively. Avoid this.

Excerpt from a sample trace:

```
QgsMapLayer::setCrs :
QgsVectorLayer::setCoordinateSystem :
QgsVectorLayer::setDataSource :
QgsVectorLayer::QgsVectorLayer :
QgsCoordinateBoundsPreviewMapWidget::QgsCoordinateBoundsPreviewMapWidget :
QgsProjectionSelectionTreeWidget::setShowNoProjection :
QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget :
QgsProjectionSelectionDialog::setShowNoProjection :
QgsProjectionSelectionDialog::QgsProjectionSelectionDialog :
QgisApp::validateCrs :
QObject::qt_static_metacall :
QgisApp::customCrsValidation :
QgisApp::customProjection :
QgsMapLayer::setCrs :
QgsVectorLayer::setCoordinateSystem :
QgsVectorLayer::setDataSource :
QgsVectorLayer::QgsVectorLayer :
QgsCoordinateBoundsPreviewMapWidget::QgsCoordinateBoundsPreviewMapWidget :
QgsProjectionSelectionTreeWidget::setShowNoProjection :
QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget :
QgsProjectionSelectionDialog::setShowNoProjection :
QgsProjectionSelectionDialog::QgsProjectionSelectionDialog :
QgisApp::validateCrs :
QObject::qt_static_metacall :
QgisApp::customCrsValidation :
QgisApp::customProjection :
QgsMapLayer::setCrs :
QgsVectorLayer::setCoordinateSystem :
QgsVectorLayer::setDataSource :
QgsVectorLayer::QgsVectorLayer :
QgsCoordinateBoundsPreviewMapWidget::QgsCoordinateBoundsPreviewMapWidget :
QgsProjectionSelectionTreeWidget::setShowNoProjection :
QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget :
QgsProjectionSelectionDialog::setShowNoProjection :
QgsProjectionSelectionDialog::QgsProjectionSelectionDialog :
QgisApp::validateCrs :
QObject::qt_static_metacall :
QgisApp::customCrsValidation :
QgisApp::customProjection :
QgsMapLayer::setCrs :
QgsVectorLayer::setCoordinateSystem :
QgsVectorLayer::setDataSource :
QgsVectorLayer::QgsVectorLayer :
QgsCoordinateBoundsPreviewMapWidget::QgsCoordinateBoundsPreviewMapWidget :
QgsProjectionSelectionTreeWidget::setShowNoProjection :
QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget :
QgsProjectionSelectionDialog::setShowNoProjection :
QgsProjectionSelectionDialog::QgsProjectionSelectionDialog :
QgisApp::validateCrs :
QObject::qt_static_metacall :
QgisApp::customCrsValidation :
```
@github-actions github-actions bot added this to the 3.22.0 milestone Jul 23, 2021
Copy link
Contributor

@elpaso elpaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I guess you checked if there was another way to prevent this error conditions and (for instance) do not trigger QgsCoordinateBoundsPreviewMapWidget, or block signals.

@m-kuhn
Copy link
Member Author

m-kuhn commented Jul 24, 2021

Yes, I evaluated some alternatives, this one seemed to be the least intrusive and most straightforward one.

@m-kuhn m-kuhn merged commit c74e886 into qgis:master Jul 24, 2021
@m-kuhn m-kuhn deleted the avoid_projection_selection_recursion_crash branch July 24, 2021 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants