From d25dee10b2f5d9491bdc32ed2e224b2066f6c647 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 18 Jul 2020 17:51:31 +0200 Subject: [PATCH] Keep last menu in memory Might do something about #1790 --- src/widgets/helper/ChannelView.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 7dad3f49c..57ff77a7c 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -1648,10 +1648,15 @@ void ChannelView::addContextMenuItems( const auto &creator = hoveredElement->getCreator(); auto creatorFlags = creator.getFlags(); + static QMenu *previousMenu = nullptr; + if (previousMenu != nullptr) + { + previousMenu->deleteLater(); + previousMenu = nullptr; + } + auto menu = new QMenu; - connect(menu, &QMenu::aboutToHide, [menu] { - menu->deleteLater(); // - }); + previousMenu = menu; // Emote actions if (creatorFlags.hasAny(