[macruby-changes] [2922] MacRuby/trunk/lib/hotcocoa/notification_listener.rb
source_changes at macosforge.org
source_changes at macosforge.org
Thu Oct 29 20:46:52 PDT 2009
Revision: 2922
http://trac.macosforge.org/projects/ruby/changeset/2922
Author: rich at 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:
--------------
MacRuby/trunk/lib/hotcocoa/notification_listener.rb
Modified: MacRuby/trunk/lib/hotcocoa/notification_listener.rb
===================================================================
--- 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091029/55133cb4/attachment.html>
More information about the macruby-changes
mailing list