Revision
2922
Author
rich@infoether.com
Date
2009-10-29 20:46:49 -0700 (Thu, 29 Oct 2009)

Log Message

retain a list of all listeners so they are not garbage collected

Modified Paths

Diff

Modified: MacRuby/trunk/lib/hotcocoa/notification_listener.rb (2921 => 2922)


--- MacRuby/trunk/lib/hotcocoa/notification_listener.rb	2009-10-29 23:36:01 UTC (rev 2921)
+++ MacRuby/trunk/lib/hotcocoa/notification_listener.rb	2009-10-30 03:46:49 UTC (rev 2922)
@@ -11,12 +11,17 @@
     
     attr_reader :callback, :name, :sender, :suspension_behavior
     
+    def self.registered_listeners
+      @registered_listeners ||= []
+    end
+    
     def initialize(options={}, &block)
       @callback = block
       @distributed = (options[:distributed] == true)
       @suspension_behavior = DistributedBehaviors[options[:when_suspended] || :coalesce]
       @name = options[:named]
       @sender = options[:sent_by]
+      NotificationListener.registered_listeners << self
       observe
     end