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

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

  NSLog(@"menu retain count before = %d", [menu retainCount]);
  {
      CREATE_AUTORELEASE_POOL(pool2);
      menuItem = [[NSMenuItem alloc] init];
      [menu addItem: menuItem];
      RELEASE(menuItem);
      RELEASE(pool2);
  }
  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é
[EMAIL PROTECTED]



_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to