Use the NSArchiver to copy the menu since the copy method does not do a deep enough copy.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33234 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2011-06-02 20:22:39 +00:00
parent 12865cbdb9
commit f9488e2af4
2 changed files with 17 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2011-06-02 16:17-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/GSThemeMenu.m: Use NSArchiver to copy menu instead of
copy. Add comment to explain why this is done. The
copy method causes all of the NSMenu instances to share
NSMenuItems. This appears to be causing a crash when the
menu updates.
2011-06-02 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSApplication.m (-finishLaunching): Move creation of the

View file

@ -62,10 +62,17 @@
GSWindowDecorationView *wv = [window windowView];
if ([window menu] == nil && menu != nil)
{
// NSData *data = [NSArchiver archivedDataWithRootObject: menu]; // copy the view...
NSMenu *newMenu = [menu copy]; // [NSUnarchiver unarchiveObjectWithData: data];
NSData *data = [NSArchiver archivedDataWithRootObject: menu]; //
NSMenu *newMenu = [NSUnarchiver unarchiveObjectWithData: data]; // [menu copy];
NSMenuView *menuView = nil;
/*
* NOTE: The reason the copy or copyWithZone method is not used here is because
* it doesn't make a deep copy of the menu. A deep copy is needed in order to
* allow the individual menu items to be used in multiple menus at one time without
* interfering with one another's state.
*/
/*
* Set the new menu
*/