diff --git a/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp b/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp index 8ea7692e3d1..2ef68f24b48 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/preseteditor.cpp @@ -348,18 +348,19 @@ void PresetList::contextMenuEvent(QContextMenuEvent *event) if (m_scope == QSettings::SystemScope) return; - QMenu menu; + auto *menu = new QMenu(this); - QAction *addAction = menu.addAction(tr("Add Preset")); + QAction *addAction = menu->addAction(tr("Add Preset")); connect(addAction, &QAction::triggered, [&]() { createItem(); }); if (selectionModel()->hasSelection()) { - QAction *removeAction = menu.addAction(tr("Delete Selected Preset")); + QAction *removeAction = menu->addAction(tr("Delete Selected Preset")); connect(removeAction, &QAction::triggered, [&]() { removeSelectedItem(); }); } - menu.exec(event->globalPos()); + menu->exec(event->globalPos()); + menu->deleteLater(); } void PresetList::dataChanged(const QModelIndex &topLeft, diff --git a/src/plugins/qmldesigner/components/timelineeditor/splineeditor.cpp b/src/plugins/qmldesigner/components/timelineeditor/splineeditor.cpp index e6d6be4fb60..3431e5c7a7a 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/splineeditor.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/splineeditor.cpp @@ -253,6 +253,7 @@ void SplineEditor::contextMenuEvent(QContextMenuEvent *e) }); menu->exec(e->globalPos()); + menu->deleteLater(); e->accept(); }