From bc6f047c44c5e227e250a52f2812bddcc1f52a52 Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Wed, 8 Apr 2015 14:20:49 -0400 Subject: [PATCH] Even more filter thread cleanup --- src/wx/panel.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/wx/panel.cpp b/src/wx/panel.cpp index 2fb16c84..989e6d5c 100644 --- a/src/wx/panel.cpp +++ b/src/wx/panel.cpp @@ -1048,34 +1048,33 @@ public: ExitCode Entry() { + //Make sure everything is properly initialized + if(!mainFilter || !iFilter || !dst || !width) + { + std::runtime_error("ERROR: Filter not initialized!"); + lock.Unlock(); + return (wxThread::ExitCode) -1; + } //Set the starting location for the destination buffer dst = GetVerticalOffset(dst,width,band_lower,mainFilter->getScale()); while(sig.Wait() == wxCOND_NO_ERROR) { //If no source, do thread cleanup before exiting if(!src ) { - lock.Unlock(); - return (wxThread::ExitCode) 0; + break; } - if(!mainFilter || !iFilter) - { - std::runtime_error("ERROR: Filter not initialized!"); - return (wxThread::ExitCode) -1; - } - //Set the start of the source pointer to the first pixel of the appropriate height src = GetVerticalOffset(src,width,band_lower); - //Run the interframe blending filter + //Run the filters iFilter->run(src,buffer); - - // naturally, any of these with accumulation buffers like those of - // the IFB filters will screw up royally as well mainFilter->run(buffer, dst); done->Post(); } + + lock.Unlock(); return (wxThread::ExitCode) 0; } };