diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-05-31 12:23:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-05-31 12:26:09 +0100 |
commit | 446d33c39fdabff117b1228e087d037b048fd1f2 (patch) | |
tree | f9e95c6dd4acb0d56d339c2d6528dd34c4e9a5f0 /vcl/unx | |
parent | b660074d50acf7befed44c5ed770188b8f3077ec (diff) |
gtk3: crash on reusing a popup menu that has a sub menu
Typically popup menus are created froms scratch each time, which is why
this wasn't a common problem.
To reproduce, under gtk3, set a template as default in the template manager,
reset it using dropdown, now set another template as default, and reopen the
menu.. it crashes
Change-Id: I6107fbd921ada71ef7d676031651deb4b1b2d2fb
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk/gtksalmenu.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx index 6a8d52ac4584..414b6b0ed795 100644 --- a/vcl/unx/gtk/gtksalmenu.cxx +++ b/vcl/unx/gtk/gtksalmenu.cxx @@ -400,6 +400,7 @@ bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, const Rectangle& rRec gtk_widget_destroy(pWidget); g_object_unref(mpActionGroup); + ClearActionGroupAndMenuModel(); return true; #else @@ -1003,6 +1004,19 @@ void GtkSalMenu::ActivateAllSubmenus(Menu* pMenuBar) } } +void GtkSalMenu::ClearActionGroupAndMenuModel() +{ + SetMenuModel(nullptr); + mpActionGroup = nullptr; + for (GtkSalMenuItem* pSalItem : maItems) + { + if ( pSalItem->mpSubMenu != nullptr ) + { + pSalItem->mpSubMenu->ClearActionGroupAndMenuModel(); + } + } +} + void GtkSalMenu::Activate(const gchar* pCommand) { MenuAndId aMenuAndId = decode_command(pCommand); |