Qt: Prevent dangling object for profile dialog

When running the profiles dialog from the main status bar,
some objects appear to be not cleaned up properly with Qt 6.
This will circumvent this, by creating an object for the
dialog and cleaning it on closing.

Fixes #18525
This commit is contained in:
Roland Knall 2022-10-31 10:06:45 +00:00
parent a42d245c2b
commit c59804f25f
1 changed files with 3 additions and 2 deletions

View File

@ -630,10 +630,11 @@ void MainStatusBar::manageProfile()
QAction *pa = qobject_cast<QAction*>(sender());
if (pa) {
ProfileDialog cp_dialog;
ProfileDialog * cp_dialog = new ProfileDialog(this);
cp_dialog->setAttribute(Qt::WA_DeleteOnClose);
int profileAction = pa->property("dialog_action_").toInt();
cp_dialog.execAction(static_cast<ProfileDialog::ProfileAction>(profileAction));
cp_dialog->execAction(static_cast<ProfileDialog::ProfileAction>(profileAction));
}
}