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

fix #30028 Closing Vertex Edititor crashes the app #30030

merged 1 commit into from May 31, 2019


Copy link

commented May 30, 2019

fix #30028

double delete of mVertexEditor (unique_ptr in context of Qt's events)

Copy link

left a comment

Looking good. I think we should not use unique_ptr for QObject-based classes in QGIS code to avoid exactly this kind of crashes due to forced delete too early.

@@ -313,6 +313,8 @@ QgsVertexTool::~QgsVertexTool()
delete mVertexBand;
delete mEdgeBand;
delete mEndpointMarker;
if ( mVertexEditor )
delete mVertexEditor;

This comment has been minimized.

Copy link

wonder-sk May 30, 2019


no need to do "if (x) delete x;" - just do "delete x;"
and we probably don't need to do that anyway since the vertex editor widget has a parent (which will take care of its deletion)

// do not delete immediately because vertex editor
// can be still used in the qt event loop
mVertexEditor = nullptr;

This comment has been minimized.

Copy link

wonder-sk May 30, 2019


it's not necessary to do mVertexEditor = nullptr; if we are using QPointer (it would be needed if we used raw pointer)

@PeterPetrik PeterPetrik force-pushed the PeterPetrik:fix_30028_vertex_editor_crash branch from 1da67c0 to c68ca6b May 30, 2019

@PeterPetrik PeterPetrik merged commit 2cf1624 into qgis:master May 31, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.