Adam Fedor <[EMAIL PROTECTED]> writes:

> On Mar 8, 2004, at 9:02 AM, Wim Oudshoorn wrote:
>
>> The following code will throw an NSInvalidArgumentException
>>
>> [[NSNotificationCenter defaultCenter] removeObserver: nil]
>>
>> The same code on WO4.5 YellowBox and MacOSX 10.3 will
>> not throw an exception.
>>
>> So I will shortly apply a patch to fix this.
>> Any objections?
>>
>
> Well, the only objection is that I'd like to see the patch for this,
> not just the description. It's easier to see what you want done then.

Ah, I had just observed the behaviour and not written the patch.

--- base/Source/NSNotificationCenter.m	Mon Mar 15 16:07:50 2004
+++ /E/gnustep-cvs/gnustep/core/base/Source/NSNotificationCenter.m	Wed Feb  4 01:14:00 2004
@@ -735,7 +735,8 @@
                  object: (id)object
 {
   if (name == nil && object == nil && observer == nil)
-      return;
+    [NSException raise: NSInvalidArgumentException

+		format: @"Attempt to remove nil observer/name/object"];

 
   /*
    *	NB. The removal algorithm depends on an implementation characteristic
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    NSLog (@"Default center is: %@", [NSNotificationCenter defaultCenter]);
    [[NSNotificationCenter defaultCenter] removeObserver: nil];
    // insert code here...
    NSLog(@"Hello, World!");
    [pool release];
    return 0;
}
Wim Oudshoorn.

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

Reply via email to