From: Jan Djärv Date: Sun, 5 May 2013 15:16:06 +0000 (+0200) Subject: * nsmenu.m (ns_update_menubar): Move initialization of submenuTitle X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~299 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e6076b1bce12dfc10f05c39ef5264247b8ebbee7;p=emacs.git * nsmenu.m (ns_update_menubar): Move initialization of submenuTitle to where it is used, to avoid autorelease issues. Fixes: debbugs:14050 --- diff --git a/src/ChangeLog b/src/ChangeLog index a3e466954cb..03d3a7e20f5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-05-05 Jan Djärv + + * nsmenu.m (ns_update_menubar): Move initialization of submenuTitle + to where it is used, to avoid autorelease issues (Bug#14050). + 2013-05-05 Paul Eggert `write-region-inhibit-fsync' defaults to noninteractive (Bug#14273). diff --git a/src/nsmenu.m b/src/nsmenu.m index 648b568d180..baa683941f8 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -119,7 +119,6 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) id menu = [NSApp mainMenu]; static EmacsMenu *last_submenu = nil; BOOL needsSet = NO; - const char *submenuTitle = [[submenu title] UTF8String]; bool owfi; Lisp_Object items; widget_value *wv, *first_wv, *prev_wv = 0; @@ -239,7 +238,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) /* FIXME: we'd like to only parse the needed submenu, but this was causing crashes in the _common parsing code.. need to make sure proper initialization done.. */ -/* if (submenu && strcmp (submenuTitle, SSDATA (string))) +/* if (submenu && strcmp ([[submenu title] UTF8String], SSDATA (string))) continue; */ submenu_start[i] = menu_items_used; @@ -259,7 +258,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) { /* should have found a menu for this one but didn't */ fprintf (stderr, "ERROR: did not find lisp menu for submenu '%s'.\n", - submenuTitle); + [[submenu title] UTF8String]); discard_menu_items (); unbind_to (specpdl_count, Qnil); [pool release]; @@ -346,8 +345,6 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) string = AREF (items, i + 1); if (NILP (string)) break; -/* if (submenu && strcmp (submenuTitle, SSDATA (string))) - continue; */ wv->name = SSDATA (string); update_submenu_strings (wv->contents); @@ -358,6 +355,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) create a new menu for each sub and fill it. */ if (submenu) { + const char *submenuTitle = [[submenu title] UTF8String]; for (wv = first_wv->contents; wv; wv = wv->next) { if (!strcmp (submenuTitle, wv->name))