extensions/source/update/ui/updatecheckui.cxx |    3 +
 include/vcl/menubarupdateicon.hxx             |    3 +
 vcl/source/window/bubblewindow.cxx            |   43 ++++++++++++++------------
 3 files changed, 28 insertions(+), 21 deletions(-)

New commits:
commit 5dbb85ca6abfbc2b5353da1e3eb36c426fb62305
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Nov 24 12:57:44 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Nov 24 17:29:17 2022 +0100

    split RemoveBubbleWindow
    
    Change-Id: I635bb587b7306bc5f5756a0c24260f10587cc4c9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143226
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/extensions/source/update/ui/updatecheckui.cxx 
b/extensions/source/update/ui/updatecheckui.cxx
index 6a4462669090..6a4a151b1a98 100644
--- a/extensions/source/update/ui/updatecheckui.cxx
+++ b/extensions/source/update/ui/updatecheckui.cxx
@@ -164,7 +164,8 @@ void SAL_CALL UpdateCheckUI::documentEventOccured(const 
document::DocumentEvent&
 
     if( rEvent.EventName == "OnPrepareViewClosing" )
     {
-        maBubbleManager.RemoveBubbleWindow(true);
+        maBubbleManager.RemoveBubbleWindow();
+        maBubbleManager.RemoveMenuBarIcon();
     }
 }
 
diff --git a/include/vcl/menubarupdateicon.hxx 
b/include/vcl/menubarupdateicon.hxx
index f9b2932aa55c..a426da869553 100644
--- a/include/vcl/menubarupdateicon.hxx
+++ b/include/vcl/menubarupdateicon.hxx
@@ -81,9 +81,10 @@ public:
     const OUString& GetBubbleTitle() const { return maBubbleTitle; }
     const OUString& GetBubbleText() const { return maBubbleText; }
 
-    void RemoveBubbleWindow(bool bRemoveIcon);
+    void RemoveBubbleWindow();
 
     void AddMenuBarIcon(SystemWindow* pSysWin, bool bAddEventHdl);
+    void RemoveMenuBarIcon();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/bubblewindow.cxx 
b/vcl/source/window/bubblewindow.cxx
index 00a20714e0cf..f1fad815466a 100644
--- a/vcl/source/window/bubblewindow.cxx
+++ b/vcl/source/window/bubblewindow.cxx
@@ -266,7 +266,7 @@ VclPtr<BubbleWindow> 
MenuBarUpdateIconManager::GetBubbleWindow()
 
 IMPL_LINK_NOARG(MenuBarUpdateIconManager, TimeOutHdl, Timer *, void)
 {
-    RemoveBubbleWindow( false );
+    RemoveBubbleWindow();
 }
 
 IMPL_LINK(MenuBarUpdateIconManager, WindowEventHdl, VclWindowEvent&, rEvent, 
void)
@@ -278,7 +278,8 @@ IMPL_LINK(MenuBarUpdateIconManager, WindowEventHdl, 
VclWindowEvent&, rEvent, voi
         if ( mpIconSysWin == rEvent.GetWindow() )
         {
             mpIconSysWin->RemoveEventListener( maWindowEventHdl );
-            RemoveBubbleWindow( true );
+            RemoveBubbleWindow();
+            RemoveMenuBarIcon();
         }
     }
     else if ( VclEventId::WindowMenubarAdded == nEventID )
@@ -297,7 +298,10 @@ IMPL_LINK(MenuBarUpdateIconManager, WindowEventHdl, 
VclWindowEvent&, rEvent, voi
     {
         MenuBar *pMBar = static_cast<MenuBar*>(rEvent.GetData());
         if ( pMBar && ( pMBar == mpIconMBar ) )
-            RemoveBubbleWindow( true );
+        {
+            RemoveBubbleWindow();
+            RemoveMenuBarIcon();
+        }
     }
     else if ( ( nEventID == VclEventId::WindowMove ) ||
               ( nEventID == VclEventId::WindowResize ) )
@@ -382,7 +386,7 @@ IMPL_LINK(MenuBarUpdateIconManager, HighlightHdl, 
MenuBarButtonCallbackArg&, rDa
     if ( rData.bHighlight )
         maWaitIdle.Start();
     else
-        RemoveBubbleWindow(false);
+        RemoveBubbleWindow();
 
     return false;
 }
@@ -401,7 +405,8 @@ MenuBarUpdateIconManager::~MenuBarUpdateIconManager()
 {
     Application::RemoveEventListener( maApplicationEventHdl );
 
-    RemoveBubbleWindow(true);
+    RemoveBubbleWindow();
+    RemoveMenuBarIcon();
 }
 
 void MenuBarUpdateIconManager::SetShowMenuIcon(bool bShowMenuIcon)
@@ -412,7 +417,10 @@ void MenuBarUpdateIconManager::SetShowMenuIcon(bool 
bShowMenuIcon)
         if ( bShowMenuIcon )
             Application::PostUserEvent(LINK(this, MenuBarUpdateIconManager, 
UserEventHdl));
         else
-            RemoveBubbleWindow( true );
+        {
+            RemoveBubbleWindow();
+            RemoveMenuBarIcon();
+        }
     }
 }
 
@@ -486,7 +494,8 @@ void MenuBarUpdateIconManager::AddMenuBarIcon(SystemWindow 
*pSysWin, bool bAddEv
         if ( bAddEventHdl && mpIconSysWin )
             mpIconSysWin->RemoveEventListener( maWindowEventHdl );
 
-        RemoveBubbleWindow( true );
+        RemoveBubbleWindow();
+        RemoveMenuBarIcon();
 
         if ( pActiveMBar )
         {
@@ -526,19 +535,8 @@ void MenuBarUpdateIconManager::AddMenuBarIcon(SystemWindow 
*pSysWin, bool bAddEv
     }
 }
 
-void MenuBarUpdateIconManager::RemoveBubbleWindow( bool bRemoveIcon )
+void MenuBarUpdateIconManager::RemoveMenuBarIcon()
 {
-    maWaitIdle.Stop();
-    maTimeoutTimer.Stop();
-
-    if ( mpBubbleWin )
-    {
-        mpBubbleWin.disposeAndClear();
-    }
-
-    if ( !bRemoveIcon )
-        return;
-
     try {
         if ( mpIconMBar && ( mnIconID != 0 ) )
         {
@@ -555,4 +553,11 @@ void MenuBarUpdateIconManager::RemoveBubbleWindow( bool 
bRemoveIcon )
     mpIconSysWin = nullptr;
 }
 
+void MenuBarUpdateIconManager::RemoveBubbleWindow()
+{
+    maWaitIdle.Stop();
+    maTimeoutTimer.Stop();
+    mpBubbleWin.disposeAndClear();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to