summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2012-10-01 03:10:51 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2012-11-14 13:52:51 +0100
commite5db3adb30f8c838f7c41fdc5673f60d914389a3 (patch)
treeadbcdeb925d1ba0a765d059fba2aee13aa0700f5 /vcl/unx/gtk
parentf787871195817c0dddf905ba3c499587c6f5f091 (diff)
activate/deactivate do not need the solarmutex, better NULL the menu when freeing it, SetFrame should only be used on a menubar
Diffstat (limited to 'vcl/unx/gtk')
-rw-r--r--vcl/unx/gtk/window/gtksalmenu.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index d5c35fc0b479..3b71f206373f 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -376,6 +376,8 @@ void GtkSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsig
void GtkSalMenu::SetFrame( const SalFrame* pFrame )
{
SolarMutexGuard aGuard;
+ assert(mbMenuBar);
+ std::cout << "GtkSalMenu set to frame" << std::endl;
mpFrame = static_cast< const GtkSalFrame* >( pFrame );
GtkSalFrame* pFrameNonConst = const_cast<GtkSalFrame*>(mpFrame);
if(pFrameNonConst->GetMenu())
@@ -383,18 +385,21 @@ void GtkSalMenu::SetFrame( const SalFrame* pFrame )
GtkSalMenu* pOldMenu = static_cast< GtkSalMenu*>(pFrameNonConst->GetMenu());
pOldMenu->DisconnectFrame();
}
- pFrameNonConst->SetMenu( this );
- GObject* pWindow = G_OBJECT(gtk_widget_get_window( GTK_WIDGET(pFrameNonConst->getWindow()) ));
- if ( !pWindow )
- return;
// if we had a menu on the GtkSalMenu we have to free it as we generate a
// full menu anyway and we might need to reuse an existing model and
// actiongroup
if(mpMenuModel)
+ {
g_lo_menu_remove(G_LO_MENU(mpMenuModel), 0);
+ mpMenuModel = NULL;
+ }
if(mpActionGroup)
+ {
g_lo_action_group_clear( G_LO_ACTION_GROUP(mpActionGroup) );
+ mpActionGroup = NULL;
+ }
+ pFrameNonConst->SetMenu( this );
pFrameNonConst->EnsureAppMenuWatch();
// Generate the main menu structure.
UpdateNativeMenu();
@@ -595,7 +600,6 @@ void GtkSalMenu::DispatchCommand( gint itemId, const gchar *aCommand )
void GtkSalMenu::Activate( const gchar* aMenuCommand )
{
- SolarMutexGuard aGuard;
if ( mbMenuBar != TRUE )
return;
@@ -603,13 +607,12 @@ void GtkSalMenu::Activate( const gchar* aMenuCommand )
if ( pSalSubMenu != NULL ) {
pSalSubMenu->mpVCLMenu->Activate();
- UpdateNativeMenu2(pSalSubMenu);
+ UpdateNativeMenu2( pSalSubMenu );
}
}
void GtkSalMenu::Deactivate( const gchar* aMenuCommand )
{
- SolarMutexGuard aGuard;
if ( mbMenuBar != TRUE )
return;