From ea2261fac59fde0129bcdafb3e8f8ee94afc635f Mon Sep 17 00:00:00 2001 From: Antonio Fernandez Date: Wed, 19 Sep 2012 20:05:56 +0100 Subject: Fixed a crash updating the menu after opening an application from main screen. Change-Id: If7b603dca5aa33e50a63e04fda3bce594840cc57 --- vcl/unx/gtk/window/gtksalmenu.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'vcl/unx') diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx index fe3b4cdc4e59..60942a5dc218 100644 --- a/vcl/unx/gtk/window/gtksalmenu.cxx +++ b/vcl/unx/gtk/window/gtksalmenu.cxx @@ -130,6 +130,8 @@ static void UpdateNativeMenu2( GtkSalMenu *pMenu ) if ( pSubmenu && pSubmenu->GetMenu() ) { + pMenu->NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, FALSE, TRUE ); + GLOMenu* pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos ); if ( pSubMenuModel == NULL ) @@ -138,7 +140,8 @@ static void UpdateNativeMenu2( GtkSalMenu *pMenu ) g_lo_menu_set_submenu_to_item_in_section( pLOMenu, nSection, nItemPos, G_MENU_MODEL( pSubMenuModel ) ); } - pMenu->NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, FALSE, TRUE ); + g_object_unref( pSubMenuModel ); + pSubmenu->SetMenuModel( G_MENU_MODEL( pSubMenuModel ) ); pSubmenu->SetActionGroup( pActionGroup ); } @@ -230,6 +233,8 @@ static void UpdateNativeMenu( GtkSalMenu* pMenu ) if ( pSubmenu && pSubmenu->GetMenu() ) { + pMenu->NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, FALSE, TRUE ); + GLOMenu* pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos ); if ( pSubMenuModel == NULL ) @@ -238,7 +243,7 @@ static void UpdateNativeMenu( GtkSalMenu* pMenu ) g_lo_menu_set_submenu_to_item_in_section( pLOMenu, nSection, nItemPos, G_MENU_MODEL( pSubMenuModel ) ); } - pMenu->NativeSetItemCommand( nSection, nItemPos, nId, aNativeCommand, itemBits, FALSE, TRUE ); + g_object_unref( pSubMenuModel ); pSubmenu->GetMenu()->Activate(); pSubmenu->GetMenu()->Deactivate(); -- cgit v1.2.1