[Libreoffice-commits] core.git: vcl/unx

Matthew J. Francis mjay.francis at gmail.com
Tue Sep 23 05:49:37 PDT 2014


 vcl/unx/gtk/window/gtksalmenu.cxx |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit d150dac1c32e89df4176d417d12a03fbbf1972d4
Author: Matthew J. Francis <mjay.francis at gmail.com>
Date:   Tue Sep 23 20:26:38 2014 +0800

    Fix memory leaks
    
    Change-Id: I7cd727657a9e426a43f72d1c5b843e581cfe8c5d
    Reviewed-on: https://gerrit.libreoffice.org/11608
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk/window/gtksalmenu.cxx b/vcl/unx/gtk/window/gtksalmenu.cxx
index 6622545..7a56ad6 100644
--- a/vcl/unx/gtk/window/gtksalmenu.cxx
+++ b/vcl/unx/gtk/window/gtksalmenu.cxx
@@ -215,7 +215,11 @@ gint CompareStr( gpointer str1, gpointer str2 )
 void RemoveUnusedCommands( GLOActionGroup* pActionGroup, GList* pOldCommandList, GList* pNewCommandList )
 {
     if ( pActionGroup == NULL || pOldCommandList == NULL )
+    {
+        g_list_free_full( pOldCommandList, g_free );
+        g_list_free_full( pNewCommandList, g_free );
         return;
+    }
 
     while ( pNewCommandList != NULL )
     {
@@ -570,8 +574,17 @@ void GtkSalMenu::NativeCheckItem( unsigned nSection, unsigned nItemPos, MenuItem
                 pCheckValue = g_variant_new_boolean( bCheck );
         }
 
-        if ( pCheckValue != NULL && ( pCurrentState == NULL || g_variant_equal( pCurrentState, pCheckValue ) == FALSE ) )
-            g_action_group_change_action_state( mpActionGroup, aCommand, pCheckValue );
+        if ( pCheckValue != NULL )
+        {
+            if ( pCurrentState == NULL || g_variant_equal( pCurrentState, pCheckValue ) == FALSE )
+            {
+                g_action_group_change_action_state( mpActionGroup, aCommand, pCheckValue );
+            }
+            else
+            {
+                g_variant_unref (pCheckValue);
+            }
+        }
 
         if ( pCurrentState != NULL )
             g_variant_unref( pCurrentState );
@@ -629,6 +642,7 @@ void GtkSalMenu::NativeSetAccelerator( unsigned nSection, unsigned nItemPos, con
         g_lo_menu_set_accelerator_to_item_in_section ( G_LO_MENU( mpMenuModel ), nSection, nItemPos, aAccelerator );
 
     g_free( aAccelerator );
+    g_free( aCurrentAccel );
 }
 
 void GtkSalMenu::NativeSetItemCommand( unsigned nSection,


More information about the Libreoffice-commits mailing list