[gtk-mac-integration] Fix double-free crash if last menu item is a separator.
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-mac-integration] Fix double-free crash if last menu item is a separator.
- Date: Fri, 11 Oct 2013 21:58:29 +0000 (UTC)
commit e72a3dd706e7bb527a27515230e1027331c75722
Author: John Ralls <jralls ceridwen us>
Date: Fri Oct 11 12:12:52 2013 -0700
Fix double-free crash if last menu item is a separator.
src/cocoa_menu_item.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/cocoa_menu_item.c b/src/cocoa_menu_item.c
index 38dbe71..5d8b71b 100644
--- a/src/cocoa_menu_item.c
+++ b/src/cocoa_menu_item.c
@@ -692,14 +692,17 @@ cocoa_menu_item_add_submenu (GtkMenuShell *menu_shell,
_GNSMenuItem *item = (_GNSMenuItem*)[cocoa_menu itemAtIndex: index];
if ([item isSeparatorItem] &&
(last_cocoa_item == nil || [last_cocoa_item isSeparatorItem]))
+ {
[cocoa_menu removeItem: item];
+ continue;
+ }
if (([item respondsToSelector: @selector (isMarked)]) && [item isMarked])
[cocoa_menu removeItem: item];
else if (![item isHidden])
last_cocoa_item = item;
}
/* Finally make sure that the last item isn't a separator. */
- if ([last_cocoa_item isSeparatorItem])
+ if (last_cocoa_item != nil && [last_cocoa_item isSeparatorItem])
[cocoa_menu removeItem: last_cocoa_item];
g_list_free (children);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]