[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Jan 25 08:33:25 UTC 2019
vcl/unx/gtk3/gtk3gtkinst.cxx | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
New commits:
commit cf185ecb5a3cd2f71a5fdf9960a05c521e489521
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jan 24 14:31:08 2019 +0000
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jan 25 09:32:57 2019 +0100
Resolves: tdf#122931 crash on closing b&n dialog after gallery menu activated
Change-Id: I3284edc2ed64895642bd12ea479a1aba8023b2ba
Reviewed-on: https://gerrit.libreoffice.org/66883
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index bdfee6ede884..ed29dc28be65 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1823,6 +1823,15 @@ public:
g_signal_connect(pMenuItem, "activate", G_CALLBACK(signalActivate), this);
}
+ void remove_from_map(GtkMenuItem* pMenuItem)
+ {
+ const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pMenuItem));
+ OString id(pStr, pStr ? strlen(pStr) : 0);
+ auto iter = m_aMap.find(id);
+ g_signal_handlers_disconnect_by_data(iter->second, this);
+ m_aMap.erase(iter);
+ }
+
void disable_item_notify_events()
{
for (auto& a : m_aMap)
@@ -4133,6 +4142,7 @@ public:
class GtkInstanceMenu : public MenuHelper, public virtual weld::Menu
{
protected:
+ std::vector<GtkMenuItem*> m_aExtraItems;
OString m_sActivated;
GtkInstanceMenuButton* m_pTopLevelMenuButton;
@@ -4291,12 +4301,22 @@ public:
gtk_menu_shell_append(GTK_MENU_SHELL(m_pMenu), pItem);
gtk_widget_show(pItem);
GtkMenuItem* pMenuItem = GTK_MENU_ITEM(pItem);
+ m_aExtraItems.push_back(pMenuItem);
add_to_map(pMenuItem);
if (m_pTopLevelMenuButton)
m_pTopLevelMenuButton->add_to_map(pMenuItem);
if (pos != -1)
gtk_menu_reorder_child(m_pMenu, pItem, pos);
}
+
+ virtual ~GtkInstanceMenu() override
+ {
+ if (m_pTopLevelMenuButton)
+ {
+ for (auto a : m_aExtraItems)
+ m_pTopLevelMenuButton->remove_from_map(a);
+ }
+ }
};
class GtkInstanceRadioButton : public GtkInstanceToggleButton, public virtual weld::RadioButton
More information about the Libreoffice-commits
mailing list