[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Feb 10 16:43:03 UTC 2021
vcl/unx/gtk3/gtk3gtksalmenu.cxx | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
New commits:
commit 951d9fe0b5470085ae817c3af04014e6dd95b498
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 10 12:53:52 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Feb 10 17:42:17 2021 +0100
Resolves: tdf#140225 remove action when item is removed from GtkSalMenu
and we have previously ensured that all items are removed by
Menu::dispose before GtkSalMenu dtor is called
Change-Id: Id91cfb96a16dfa7c55bb8bc6676cb7921ec8dd37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110704
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtk3gtksalmenu.cxx b/vcl/unx/gtk3/gtk3gtksalmenu.cxx
index e81222b69482..3ed2487ff4f3 100644
--- a/vcl/unx/gtk3/gtk3gtksalmenu.cxx
+++ b/vcl/unx/gtk3/gtk3gtksalmenu.cxx
@@ -596,23 +596,15 @@ GtkSalMenu::~GtkSalMenu()
{
SolarMutexGuard aGuard;
- if (mpActionGroup)
- {
- // tdf#140225 if any menu is deleted clear the action-group shared
- // by the hierarchy
- GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP(mpActionGroup);
- g_lo_action_group_clear(pActionGroup);
- // and flag the hierarchy as needing an update
- SetNeedsUpdate();
- }
+ // tdf#140225 we expect all items to be removed by Menu::dispose
+ // before this dtor is called
+ assert(maItems.empty());
DestroyMenuBarWidget();
if (mpMenuModel)
g_object_unref(mpMenuModel);
- maItems.clear();
-
if (mpFrame)
mpFrame->SetMenu(nullptr);
}
@@ -640,6 +632,16 @@ void GtkSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
void GtkSalMenu::RemoveItem( unsigned nPos )
{
SolarMutexGuard aGuard;
+
+ // tdf#140225 clear associated action when the item is removed
+ if (mpActionGroup)
+ {
+ GLOActionGroup* pActionGroup = G_LO_ACTION_GROUP(mpActionGroup);
+ gchar* pCommand = GetCommandForItem(maItems[nPos]);
+ g_lo_action_group_remove(pActionGroup, pCommand);
+ g_free(pCommand);
+ }
+
maItems.erase( maItems.begin() + nPos );
SetNeedsUpdate();
}
More information about the Libreoffice-commits
mailing list