motion-prime/elements/image.rb in motion-prime-1.0.6 vs motion-prime/elements/image.rb in motion-prime-1.0.7

- old
+ new

@@ -9,27 +9,23 @@ def fetch_image return unless computed_options[:url] raise "You must set default image for `#{name}`" unless computed_options[:default] view.setImage(computed_options[:default].uiimage) - ref_key = allocate_strong_references + refs = strong_references BW::Reactor.schedule do manager = SDWebImageManager.sharedManager manager.downloadWithURL(computed_options[:url], options: 0, progress: lambda{ |r_size, e_size| }, completed: lambda{ |image, error, type, finished| - unless image - release_strong_references(ref_key) - return - end + return if !image || !refs.all?(&:weakref_alive?) if computed_options[:post_process].present? image = computed_options[:post_process][:method].to_proc.call(computed_options[:post_process][:target], image) end self.performSelectorOnMainThread :set_image, withObject: image, waitUntilDone: true - release_strong_references(ref_key) } ) end end \ No newline at end of file