sc/source/ui/cctrl/checklistmenu.cxx |   11 +++++++++--
 sc/source/ui/inc/checklistmenu.hxx   |    1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit c3449cf4f2048b31ca19fb5e147cb579758fb63c
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Nov 27 19:48:49 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Nov 28 21:33:19 2021 +0100

    Resolves: tdf#145863 crash on click after quick double click
    
    Change-Id: I18862328a3239424de80b478a09f568b5dcef1ac
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125901
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index d8c210156624..e140cee466d0 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -401,12 +401,18 @@ void ScCheckListMenuControl::setSubMenuFocused(const 
ScListSubMenuControl* pSubM
 
 void ScCheckListMenuControl::EndPopupMode()
 {
+    if (!mbIsPoppedUp)
+        return;
+    mxPopover->connect_closed(Link<weld::Popover&, void>());
     mxPopover->popdown();
+    PopupModeEndHdl(*mxPopover);
+    assert(mbIsPoppedUp == false);
 }
 
 void ScCheckListMenuControl::StartPopupMode(weld::Widget* pParent, const 
tools::Rectangle& rRect)
 {
     mxPopover->connect_closed(LINK(this, ScCheckListMenuControl, 
PopupModeEndHdl));
+    mbIsPoppedUp = true;
     mxPopover->popup_at_rect(pParent, rRect);
     GrabFocus();
 }
@@ -466,6 +472,7 @@ 
ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent,
     , mpNotifier(pNotifier)
     , mbHasDates(bHasDates)
     , mbCanHaveSubMenu(bCanHaveSubMenu)
+    , mbIsPoppedUp(false)
     , maOpenTimer(this)
     , maCloseTimer(this)
 {
@@ -1405,8 +1412,8 @@ void ScCheckListMenuControl::setPopupEndAction(Action* p)
 
 IMPL_LINK_NOARG(ScCheckListMenuControl, PopupModeEndHdl, weld::Popover&, void)
 {
-    if (mxMenu)
-        clearSelectedMenuItem();
+    mbIsPoppedUp = false;
+    clearSelectedMenuItem();
     if (mxPopupEndAction)
         mxPopupEndAction->execute();
 
diff --git a/sc/source/ui/inc/checklistmenu.hxx 
b/sc/source/ui/inc/checklistmenu.hxx
index 761bbf027f14..c73843df8a16 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -294,6 +294,7 @@ private:
 
     bool mbHasDates;
     bool mbCanHaveSubMenu;
+    bool mbIsPoppedUp;
 
     struct SubMenuItemData
     {

Reply via email to