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

[Backport queued_ltr_backports] qgs3daxis: Correctly delete axis or cube in the destructor #57933

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions src/3d/qgs3daxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,25 @@ Qgs3DAxis::~Qgs3DAxis()
delete mMenu;
mMenu = nullptr;

// If a root entity is not enabled, it means that it does not have a parent.
// When an object (axis or cube) is not enabled. It is still present but it does not have a parent.
// In that case, it will never be automatically deleted. Therefore, it needs to be manually deleted.
// See setEnableCube() and setEnableAxis().
if ( !mCubeRoot->isEnabled() )
switch ( mMapSettings->get3DAxisSettings().mode() )
{
delete mCubeRoot;
mCubeRoot = nullptr;
}

if ( !mAxisRoot->isEnabled() )
{
delete mAxisRoot;
mAxisRoot = nullptr;
case Qgs3DAxisSettings::Mode::Crs:
delete mCubeRoot;
mCubeRoot = nullptr;
break;
case Qgs3DAxisSettings::Mode::Cube:
delete mAxisRoot;
mAxisRoot = nullptr;
break;
case Qgs3DAxisSettings::Mode::Off:
delete mAxisRoot;
mAxisRoot = nullptr;
delete mCubeRoot;
mCubeRoot = nullptr;
break;
}
}

Expand Down
Loading