aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Djärv2013-08-11 17:34:26 +0200
committerJan Djärv2013-08-11 17:34:26 +0200
commitf90e3ebd13de8169ada56274f3abaa1ea8dc6d05 (patch)
treed7967ba697c4bc6cd608f1451e3ab0a44050ff75
parent423d3b3f9acf6b4d9f9a0b8a22a20809896117e4 (diff)
downloademacs-f90e3ebd13de8169ada56274f3abaa1ea8dc6d05.tar.gz
emacs-f90e3ebd13de8169ada56274f3abaa1ea8dc6d05.zip
Fix crash on OSX >= 10.7.
* nsmenu.m (ns_update_menubar): Call fillWithWidgetValue:frame: (initWithTitle:): Initialize frame to 0. (fillWithWidgetValue:): Call fillWithWidgetValue:frame. (fillWithWidgetValue:frame:): Renamed from fillWithWidgetValue:setDelegate, call initWithTile:frame: if f. * nsterm.h (EmacsMenu): fillWithWidgetValue:setDelegate renamed to fillWithWidgetValue:frame:
-rw-r--r--src/ChangeLog9
-rw-r--r--src/nsmenu.m17
-rw-r--r--src/nsterm.h2
3 files changed, 20 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f8aea1dc83b..fce45d37447 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,14 @@
12013-08-11 Jan Djärv <jan.h.d@swipnet.se> 12013-08-11 Jan Djärv <jan.h.d@swipnet.se>
2 2
3 * nsmenu.m (ns_update_menubar): Call fillWithWidgetValue:frame:
4 (initWithTitle:): Initialize frame to 0.
5 (fillWithWidgetValue:): Call fillWithWidgetValue:frame.
6 (fillWithWidgetValue:frame:): Renamed from
7 fillWithWidgetValue:setDelegate, call initWithTile:frame: if f.
8
9 * nsterm.h (EmacsMenu): fillWithWidgetValue:setDelegate renamed to
10 fillWithWidgetValue:frame:
11
3 * nsfns.m (Fns_convert_utf8_nfd_to_nfc): Allocate and release pool to 12 * nsfns.m (Fns_convert_utf8_nfd_to_nfc): Allocate and release pool to
4 remove memory leak warnings. 13 remove memory leak warnings.
5 14
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 1ae2a34ab92..2850f0ed97d 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -366,7 +366,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
366 } 366 }
367 else 367 else
368 { 368 {
369 [menu fillWithWidgetValue: first_wv->contents setDelegate:YES]; 369 [menu fillWithWidgetValue: first_wv->contents frame: f];
370 } 370 }
371 371
372 } 372 }
@@ -527,6 +527,7 @@ x_activate_menubar (struct frame *f)
527/* override designated initializer */ 527/* override designated initializer */
528- initWithTitle: (NSString *)title 528- initWithTitle: (NSString *)title
529{ 529{
530 frame = 0;
530 if ((self = [super initWithTitle: title])) 531 if ((self = [super initWithTitle: title]))
531 [self setAutoenablesItems: NO]; 532 [self setAutoenablesItems: NO];
532 return self; 533 return self;
@@ -725,10 +726,10 @@ extern NSString *NSMenuDidBeginTrackingNotification;
725 726
726- (void)fillWithWidgetValue: (void *)wvptr 727- (void)fillWithWidgetValue: (void *)wvptr
727{ 728{
728 [self fillWithWidgetValue: wvptr setDelegate:NO]; 729 [self fillWithWidgetValue: wvptr frame:nil];
729} 730}
730 731
731- (void)fillWithWidgetValue: (void *)wvptr setDelegate: (BOOL)set 732- (void)fillWithWidgetValue: (void *)wvptr frame: (struct frame *)f
732{ 733{
733 widget_value *wv = (widget_value *)wvptr; 734 widget_value *wv = (widget_value *)wvptr;
734 735
@@ -743,11 +744,13 @@ extern NSString *NSMenuDidBeginTrackingNotification;
743 744
744 if (wv->contents) 745 if (wv->contents)
745 { 746 {
746 EmacsMenu *submenu = [[EmacsMenu alloc] initWithTitle: [item title]]; 747 EmacsMenu *submenu;
748
749 if (f)
750 submenu = [[EmacsMenu alloc] initWithTitle: [item title] frame:f];
751 else
752 submenu = [[EmacsMenu alloc] initWithTitle: [item title]];
747 753
748#ifdef NS_IMPL_COCOA
749 if (set) [submenu setDelegate: submenu];
750#endif
751 [self setSubmenu: submenu forItem: item]; 754 [self setSubmenu: submenu forItem: item];
752 [submenu fillWithWidgetValue: wv->contents]; 755 [submenu fillWithWidgetValue: wv->contents];
753 [submenu release]; 756 [submenu release];
diff --git a/src/nsterm.h b/src/nsterm.h
index cf8e26d14a6..7843f369d24 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -196,7 +196,7 @@ typedef float EmacsCGFloat;
196- (NSString *)parseKeyEquiv: (const char *)key; 196- (NSString *)parseKeyEquiv: (const char *)key;
197- (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr; 197- (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr;
198- (void)fillWithWidgetValue: (void *)wvptr; 198- (void)fillWithWidgetValue: (void *)wvptr;
199- (void)fillWithWidgetValue: (void *)wvptr setDelegate: (BOOL)set; 199- (void)fillWithWidgetValue: (void *)wvptr frame: (struct frame *)f;
200- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f; 200- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f;
201- (void) clear; 201- (void) clear;
202- (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f 202- (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f