From 0be69551526343f1a49dbeb048f040767fd502fc Mon Sep 17 00:00:00 2001 From: "ollie-hpcnt@hpcnt.com" Date: Wed, 5 Sep 2018 12:37:27 +0900 Subject: [PATCH] Fix framebuffer over release issue --- framework/Source/Pipeline.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/framework/Source/Pipeline.swift b/framework/Source/Pipeline.swift index 65611ea7..64fc6b17 100755 --- a/framework/Source/Pipeline.swift +++ b/framework/Source/Pipeline.swift @@ -52,16 +52,21 @@ public extension ImageSource { } public func updateTargetsWithFramebuffer(_ framebuffer:Framebuffer) { - if targets.count == 0 { // Deal with the case where no targets are attached by immediately returning framebuffer to cache + var foundTargets = [(ImageConsumer, UInt)]() + for target in targets { + foundTargets.append(target) + } + + if foundTargets.count == 0 { // Deal with the case where no targets are attached by immediately returning framebuffer to cache framebuffer.lock() framebuffer.unlock() } else { // Lock first for each output, to guarantee proper ordering on multi-output operations - for _ in targets { + for _ in foundTargets { framebuffer.lock() } } - for (target, index) in targets { + for (target, index) in foundTargets { target.newFramebufferAvailable(framebuffer, fromSourceIndex:index) } }