FROM : Christiaan Hofman
DATE : Sun May 18 22:27:07 2008
On 18 May 2008, at 8:31 PM, Shawn Erickson wrote:
> On Sat, May 17, 2008 at 6:59 AM, Christiaan Hofman
> <<email_removed>> wrote:
>> I have recently changed some KVO observation code to us a static
>> NSString as
>> the context when registering as KVO observation. However now that
>> seems to
>> have introduced a crasher when removing the observer, at least on a
>> Core Duo
>> Intel machine. PPC does not seem to have any problem. So is there
>> some
>> problem using NSStrings as observation context for Intel? The
>> Sketch sample
>> code also uses those.
>
> Can you be more specific about the crash you are seeing? (backtrace,
> etc.)
>
This is the top part of the crash
Thread 0 Crashed:
0 libobjc.A.dylib 0x90a59380 objc_msgSend + 16
1 com.apple.Foundation 0x928a26a7
-[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] +
233
2 com.apple.AppKit 0x93534a02 -[NSController
removeObserver:forKeyPath:] + 208
After that comes some app specific trace that clearly points to a
particular -removeObserver:forKeyPath: on NSUserDefaultsController in -
windowWillClose: for the main document window.
> Are you removing the observation of the same key more then once? I
> have seen a over release bug in the Cocoa framework in situations like
> this (trying to locate my information on that issue...).
>
> -Shawn
No, -windowWillClose: can never be called twice, because the document
is closed after that. And the corresponding -addObserver:... is called
in -windowControllerDidLoadNib:, which is called for sure.
Christiaan
DATE : Sun May 18 22:27:07 2008
On 18 May 2008, at 8:31 PM, Shawn Erickson wrote:
> On Sat, May 17, 2008 at 6:59 AM, Christiaan Hofman
> <<email_removed>> wrote:
>> I have recently changed some KVO observation code to us a static
>> NSString as
>> the context when registering as KVO observation. However now that
>> seems to
>> have introduced a crasher when removing the observer, at least on a
>> Core Duo
>> Intel machine. PPC does not seem to have any problem. So is there
>> some
>> problem using NSStrings as observation context for Intel? The
>> Sketch sample
>> code also uses those.
>
> Can you be more specific about the crash you are seeing? (backtrace,
> etc.)
>
This is the top part of the crash
Thread 0 Crashed:
0 libobjc.A.dylib 0x90a59380 objc_msgSend + 16
1 com.apple.Foundation 0x928a26a7
-[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] +
233
2 com.apple.AppKit 0x93534a02 -[NSController
removeObserver:forKeyPath:] + 208
After that comes some app specific trace that clearly points to a
particular -removeObserver:forKeyPath: on NSUserDefaultsController in -
windowWillClose: for the main document window.
> Are you removing the observation of the same key more then once? I
> have seen a over release bug in the Cocoa framework in situations like
> this (trying to locate my information on that issue...).
>
> -Shawn
No, -windowWillClose: can never be called twice, because the document
is closed after that. And the corresponding -addObserver:... is called
in -windowControllerDidLoadNib:, which is called for sure.
Christiaan






Cocoa mail archive

