[Libreoffice-commits] core.git: vcl/qt5

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jan 11 13:46:31 UTC 2019


 vcl/qt5/Qt5Menu.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 35b59e56cc01e5ecf97583ab7b7884d301457089
Author:     Aleksei Nikiforov <darktemplar at basealt.ru>
AuthorDate: Thu Jan 10 15:54:56 2019 +0300
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Jan 11 14:46:05 2019 +0100

    Unregister action when menu item is removed
    
    Change-Id: I9fc5e6630560f285eeb7ef4dbc5e39ccabd5f0df
    Reviewed-on: https://gerrit.libreoffice.org/66147
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 51fca6cff27b..648ceb29ade6 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -185,7 +185,15 @@ void Qt5Menu::InsertItem(SalMenuItem* pSalMenuItem, unsigned nPos)
 void Qt5Menu::RemoveItem(unsigned nPos)
 {
     SolarMutexGuard aGuard;
-    maItems.erase(maItems.begin() + nPos);
+
+    if (nPos < maItems.size())
+    {
+        Qt5MenuItem* pItem = maItems[nPos];
+        pItem->mpAction.reset();
+        pItem->mpMenu.reset();
+
+        maItems.erase(maItems.begin() + nPos);
+    }
 }
 
 void Qt5Menu::SetSubMenu(SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned)


More information about the Libreoffice-commits mailing list