motion/reactor.rb in bubble-wrap-1.4.0 vs motion/reactor.rb in bubble-wrap-1.5.0.rc1
- old
+ new
@@ -84,10 +84,11 @@
end
# Schedule a block for execution on the reactor queue.
def schedule(*args, &blk)
@queue ||= ::Dispatch::Queue.concurrent("#{NSBundle.mainBundle.bundleIdentifier}.reactor")
+ blk.weak! if blk && BubbleWrap.use_weak_callbacks?
cb = proc do
blk.call(*args)
end
@queue.async &cb
@@ -96,9 +97,10 @@
# Schedule a block for execution on your application's main thread.
# This is useful as UI updates need to be executed from the main
# thread.
def schedule_on_main(*args, &blk)
+ blk.weak! if blk && BubbleWrap.use_weak_callbacks?
cb = proc do
blk.call(*args)
end
::Dispatch::Queue.main.async &cb
end