[Top][All Lists]

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

Re: [PATCH] Fix NSMenu retainCount problem

From: Quentin Mathé
Subject: Re: [PATCH] Fix NSMenu retainCount problem
Date: Fri, 6 Feb 2004 02:43:21 +0100

Le 6 févr. 04, à 01:25, Fred Kiefer a écrit :

  menu = [[NSMenu alloc] initWithTitle: @"boum"];

  NSLog(@"menu retain count before = %d", [menu retainCount]);
      menuItem = [[NSMenuItem alloc] init];
      [menu addItem: menuItem];
  NSLog(@"menu retain count after = %d", [menu retainCount]);

For me this results in a menu with a retain count of one, so it will be deallocated after the next release. GNUSteop might need and internal autorelease pool in one of the NSMenu methods

For me too. but...
It's more complex than that. The autoreleasepool in the block is just showing that the notifications involve the problem we are talking about. The problem will rise again when we will have some notifications pushed back by using _notifications variable.

Other example :
NSMenu *menu = [[NSMenu alloc] initWithTitle:@"Youlà"];
NSMenu *item = [[NSMenuItem alloc] initWithTitle:@"You" action:@selector(john:) keyEquivalent:@""];
[menu addItem:item];
[menu release];
menu = [[NSMenu alloc] initWithTitle:@"other"];
[menu addItem:item];
The code above which is ok with Cocoa doesn't work with GNUstep.

Yes, this just shows that your cleanup code in NSMenu does the right thing. That is why I wanted to use it. This has nothing to do with the notifications.

the call [menu addItem:item] has nothing to the GSTitleView issue, it has to do with the notifications.

Quentin Mathé

reply via email to

[Prev in Thread] Current Thread [Next in Thread]