vcl/inc/unx/gtk/gtksalmenu.hxx | 2 ++ vcl/unx/gtk/gtksalmenu.cxx | 14 ++++++++++++++ 2 files changed, 16 insertions(+)
New commits: commit 446d33c39fdabff117b1228e087d037b048fd1f2 Author: Caolán McNamara <[email protected]> Date: Tue May 31 12:23:12 2016 +0100 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 diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx index 31622fa..ad3e1d9 100644 --- a/vcl/inc/unx/gtk/gtksalmenu.hxx +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -112,6 +112,8 @@ public: virtual void Update() override; // Update this menu only. // Update full menu hierarchy from this menu. void UpdateFull () { ActivateAllSubmenus(mpVCLMenu); Update(); } + // Clear ActionGroup and MenuModel from full menu hierarchy + void ClearActionGroupAndMenuModel(); GtkSalMenu* GetTopLevel(); void SetNeedsUpdate(); diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx index 6a8d52a..414b6b0 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);
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
