]> git.sesse.net Git - nageru/commitdiff
Fix some more leaks on clear_queue().
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 30 Oct 2018 17:29:35 +0000 (18:29 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 30 Oct 2018 17:29:35 +0000 (18:29 +0100)
video_stream.cpp

index 82f27315b7f89dcae86e1103ffed9674b0113667..bbd4616b0885935785961923973a848d841650f0 100644 (file)
@@ -292,6 +292,19 @@ void VideoStream::clear_queue()
                q = move(frame_queue);
        }
 
+       // These are not RAII-ed, unfortunately, so we'll need to clean them ourselves.
+       // Note that release_texture() is thread-safe.
+       for (const QueuedFrame &qf : q) {
+               if (qf.type == QueuedFrame::INTERPOLATED ||
+                   qf.type == QueuedFrame::FADED_INTERPOLATED) {
+                       compute_flow->release_texture(qf.flow_tex);
+               }
+               if (qf.type == QueuedFrame::INTERPOLATED) {
+                       interpolate->release_texture(qf.output_tex);
+                       interpolate->release_texture(qf.cbcr_tex);
+               }
+       }
+
        // Destroy q outside the mutex, as that would be a double-lock.
 }