[gtk-mac-integration] Fix a refcounting bug & menu index bug



commit 71189ab5070e8b02d3d549fb2f8bb50a71e3bdc4
Author: John Ralls <jralls ceridwen us>
Date:   Tue Oct 1 22:01:59 2013 -0700

    Fix a refcounting bug & menu index bug
    
    The recent separator-skipping change exposed a double release
    of cocoa_items, and while working on it I noticed a couple of
    paths where last_item wasn't updated, which might result in
    separators being skipped incorrectly.

 src/cocoa_menu_item.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/cocoa_menu_item.c b/src/cocoa_menu_item.c
index 4774f24..3f57f1f 100644
--- a/src/cocoa_menu_item.c
+++ b/src/cocoa_menu_item.c
@@ -445,7 +445,6 @@ cocoa_menu_item_connect (GtkWidget*   menu_item,
           old_item))
         g_print ("Failed to disconnect old notify signal for %s\\n",
                  gtk_widget_get_name (menu_item));
-      [old_item release];
     }
   g_signal_connect (menu_item, "notify",
                     G_CALLBACK (cocoa_menu_item_notify),
@@ -645,6 +644,7 @@ cocoa_menu_item_add_submenu (GtkMenuShell *menu_shell,
           [cocoa_item unmark];
           cocoa_menu_item_sync (menu_item);
           ++index;
+         last_item = menu_item;
           continue;
         }
       if (cocoa_item && (loc = [cocoa_menu indexOfItem: cocoa_item]) > -1)
@@ -658,6 +658,7 @@ cocoa_menu_item_add_submenu (GtkMenuShell *menu_shell,
             [cocoa_item unmark];
           [cocoa_item release];
           cocoa_menu_item_sync (menu_item);
+         last_item = menu_item;
           continue;
         }
       if (GTK_IS_SEPARATOR_MENU_ITEM (menu_item) &&


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]