Re: [MacRuby-devel] How to stop observing

2010-04-29 Thread Dave Baldwin
Hi Laurent, Thanks for the hint. Searched and found some docs that say the same thing. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcFinalize.html Dave. On 29 Apr 2010, at 23:08, Laurent Sansonetti wrote: > Hi Dave, > > Normally, you would

Re: [MacRuby-devel] How to stop observing

2010-04-29 Thread Laurent Sansonetti
Hi Dave, Normally, you would do this in -finalize, since -dealloc will not be called under GC. Now, I believe (this should be confirmed...) that under GC, NSNotificationCenter & friends automatically unregister observers when they get collected. This is done through the weak reference machiner

[MacRuby-devel] How to stop observing

2010-04-29 Thread Dave Baldwin
A common design pattern in cocoa seems to be to have a objc method along the lines: - (void)dealloc { // Stop observing the tool palette. [[NSNotificationCenter defaultCenter] removeObserver:self name:SKTSelectedToolDidChangeNotification object:[SKTToolPaletteController sharedToolP