diff options
| author | Felix Ernst <[email protected]> | 2024-04-17 07:32:27 +0000 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2024-04-17 07:32:27 +0000 |
| commit | a07f24228a94aab2bdeb3caaf7a4d694c0180ed7 (patch) | |
| tree | e0256a0df801ce43e0e4a928eb0f9b5683166aaf | |
| parent | a16b9e582803a1ac03a8bec6c2987e7fb15f9578 (diff) | |
Fix crash while entering selection mode with Qt6.7
`deleteLater()` on a non-existing object seems to cause a crash with
Qt6.7. This makes some sense but wasn't the case previously.
I didn't test this yet but it is a harmless change so if anyone can confirm we can IMO merge directly.
This was brought up in https://invent.kde.org/system/dolphin/-/merge_requests/764#note_920935, reported in the bug linked below, and the sentry crash reporting page also has a few dozen reports (https://crash-reports.kde.org/organizations/kde/issues/13589/?project=4&query=is%3Aunresolved&referrer=issue-stream&stream_index=1).
Dolphin 24.02 is also affected but we are already past the last bug fix release for it.
BUG: 485599
| -rw-r--r-- | src/selectionmode/bottombarcontentscontainer.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/selectionmode/bottombarcontentscontainer.cpp b/src/selectionmode/bottombarcontentscontainer.cpp index d571b0302..0e3087a9c 100644 --- a/src/selectionmode/bottombarcontentscontainer.cpp +++ b/src/selectionmode/bottombarcontentscontainer.cpp @@ -483,7 +483,9 @@ std::vector<QAction *> BottomBarContentsContainer::contextActionsFor(const KFile if (selectedItems.isEmpty()) { // There are no contextual actions to show for these items. // We might even want to hide this bar in this case. To make this clear, we reset m_internalContextMenu. - m_internalContextMenu.release()->deleteLater(); + if (m_internalContextMenu) { + m_internalContextMenu.release()->deleteLater(); + } return std::vector<QAction *>{}; } |
