From ab751a3b16e3da3eb8b0cd6366dea234ce74c0ac Mon Sep 17 00:00:00 2001 From: Blaise Duszynski Date: Thu, 6 Feb 2025 19:11:31 -0600 Subject: [PATCH] Add HamburgerMenu only once per instance A new HamburgerMenu is added to the context menu each time it is opened which causes a delay after enough invocations. Skip adding another if one has already been added. BUG: 495029 --- src/session/SessionController.cpp | 10 +++++++--- src/session/SessionController.h | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/session/SessionController.cpp b/src/session/SessionController.cpp index 9e1a0fb5b..0a22b62e1 100644 --- a/src/session/SessionController.cpp +++ b/src/session/SessionController.cpp @@ -128,6 +128,7 @@ SessionController::SessionController(Session *sessionParam, TerminalDisplay *vie , _monitorProcessFinish(false) , _monitorOnce(false) , _escapedUrlFilter(nullptr) + , _addedHamburgerMenu(false) { Q_ASSERT(sessionParam); Q_ASSERT(viewParam); @@ -2089,9 +2090,12 @@ void SessionController::showDisplayContextMenu(const QPoint &position) _preventClose = true; - auto hamburger = static_cast(actionCollection()->action(KStandardAction::name(KStandardAction::HamburgerMenu))); - if (hamburger) { - hamburger->addToMenu(popup); + if (!_addedHamburgerMenu) { + auto hamburger = static_cast(actionCollection()->action(KStandardAction::name(KStandardAction::HamburgerMenu))); + if (hamburger) { + hamburger->addToMenu(popup); + _addedHamburgerMenu = true; + } } // they are here. diff --git a/src/session/SessionController.h b/src/session/SessionController.h index 590e03ef2..9689d5084 100644 --- a/src/session/SessionController.h +++ b/src/session/SessionController.h @@ -422,6 +422,8 @@ private: QAction *_startAutoSaveAction; QAction *_stopAutoSaveAction; QPointer _autoSaveTask; + + bool _addedHamburgerMenu; }; }