diff options
| author | Sebastian Englbrecht <[email protected]> | 2026-05-31 18:59:36 +0200 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2026-06-01 09:04:16 +0000 |
| commit | 44973c9dd016569e643a73148c32bd1a0b01d71d (patch) | |
| tree | 4fc83d93e58eae08986bfcbdf00a10f0e17d5b3e /src/dolphinmainwindow.cpp | |
| parent | b860b18e2dc8d00dbb72fcfe210f4e48d53ec00c (diff) | |
dolphinmainwindow,dolphinview: clarify QPointer semantics around exec()
exec() runs a nested event loop that can destroy the parent widget, so
the post-exec null-check on the QPointer is intentional, not redundant.
dolphinmainwindow: replace `if (contextMenu) deleteLater()` with
`delete contextMenu`. QPointer returns nullptr for a destroyed object,
making delete a safe no-op.
dolphinview: capture the menu as a raw pointer for pre-exec setup;
reserve the QPointer for the post-exec liveness check and deletion.
Diffstat (limited to 'src/dolphinmainwindow.cpp')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 439db8293..c1bbcc5f5 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1522,11 +1522,7 @@ void DolphinMainWindow::openContextMenu(const QPoint &pos, const KFileItem &item { QPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, item, selectedItems, url, m_fileItemActions); contextMenu->exec(pos); - - // Delete the menu, unless it has been deleted in its own nested event loop already. - if (contextMenu) { - contextMenu->deleteLater(); - } + delete contextMenu; } QMenu *DolphinMainWindow::createPopupMenu() |
