Commit ab3eb22b authored by Volker Krause's avatar Volker Krause
Browse files

Fix KHamburgerMenu crashing Kontact when switching to KOrganizer

mMenuBar is null here when running in Kontact.
parent 19f27382
Pipeline #64780 canceled with stage
......@@ -698,16 +698,18 @@ void ActionManager::initActions()
KStandardAction::preferences(mCalendarView, &CalendarView::edit_options, mACollection);
KStandardAction::keyBindings(this, &ActionManager::keyBindings, mACollection);
}
mHamburgerMenu = KStandardAction::hamburgerMenu(nullptr, nullptr, mACollection);
mHamburgerMenu->setShowMenuBarAction(mShowMenuBarAction);
mHamburgerMenu->setMenuBar(mMenuBar);
connect(mHamburgerMenu, &KHamburgerMenu::aboutToShowMenu, this, [this]() {
updateHamburgerMenu();
// Immediately disconnect. We only need to run this once, but on demand.
// NOTE: The nullptr at the end disconnects all connections between
// q and mHamburgerMenu's aboutToShowMenu signal.
disconnect(mHamburgerMenu, &KHamburgerMenu::aboutToShowMenu, this, nullptr);
});
if (mMenuBar) {
mHamburgerMenu = KStandardAction::hamburgerMenu(nullptr, nullptr, mACollection);
mHamburgerMenu->setShowMenuBarAction(mShowMenuBarAction);
mHamburgerMenu->setMenuBar(mMenuBar);
connect(mHamburgerMenu, &KHamburgerMenu::aboutToShowMenu, this, [this]() {
updateHamburgerMenu();
// Immediately disconnect. We only need to run this once, but on demand.
// NOTE: The nullptr at the end disconnects all connections between
// q and mHamburgerMenu's aboutToShowMenu signal.
disconnect(mHamburgerMenu, &KHamburgerMenu::aboutToShowMenu, this, nullptr);
});
}
}
void ActionManager::updateHamburgerMenu()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment