(main): Wrap it with an NSAutoreleasePool.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1086 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Andrew McCallum 1996-03-07 00:39:51 +00:00
parent 1b6a1efebb
commit dde3532e32

View file

@ -6,6 +6,7 @@
#include <Foundation/NSNotification.h>
#include <Foundation/NSString.h>
#include <Foundation/NSAutoreleasePool.h>
@interface Observer : NSObject
- (void) gotNotificationFoo: not;
@ -31,6 +32,9 @@ int main ()
{
id o1 = [NSObject new];
id observer1 = [Observer new];
id arp;
arp = [NSAutoreleasePool new];
[[NSNotificationCenter defaultCenter]
addObserver: observer1
@ -44,6 +48,7 @@ int main ()
name: foo
object: nil];
/* This will cause two messages to be printed, one for each request above. */
[[NSNotificationCenter defaultCenter]
postNotificationName: foo
@ -54,5 +59,26 @@ int main ()
postNotificationName: foo
object: nil];
[[NSNotificationCenter defaultCenter]
removeObserver: observer1
name: nil
object: o1];
/* This will cause message to be printed. */
[[NSNotificationCenter defaultCenter]
postNotificationName: foo
object: o1];
[[NSNotificationCenter defaultCenter]
removeObserver: observer1];
/* This will cause no messages to be printed. */
[[NSNotificationCenter defaultCenter]
postNotificationName: foo
object: o1];
[arp release];
exit (0);
}