#484: scoping issues with notification center -------------------------------------+-------------------------------------- Reporter: mattaimone...@… | Owner: lsansone...@… Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: invalid Keywords: | -------------------------------------+--------------------------------------
Comment(by lsansone...@…): It's actually documented. http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/Reference/Reference.html "Important: The notification center does not retain its observers, therefore, you must ensure that you unregister observers (using removeObserver: or removeObserver:name:object:) before they are deallocated. (If you don't, you will generate a runtime error if the center sends a message to a freed object.)" MacRuby uses Objective-C in GC mode so retain will not help since it's a no-op. You must keep a reference to the observer by yourself. Typically this isn't such a problem in Cocoa apps since the observer is generally a controller object (self). Maybe you should re-design your program. -- Ticket URL: <http://www.macruby.org/trac/ticket/484#comment:3> MacRuby <http://macruby.org/> _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel