Skip to content
Snippets Groups Projects
Commit f6398bdb authored by Julien Malik's avatar Julien Malik
Browse files

BUG: #495 also affect StreamingImageVirtualWriter - apply same fix as in a806c299f17a

parent c060f563
Branches
Tags
No related merge requests found
......@@ -174,6 +174,9 @@ private:
float m_DivisionProgress;
StreamingManagerPointerType m_StreamingManager;
bool m_IsObserving;
unsigned long m_ObserverID;
};
} // end namespace otb
......
......@@ -39,7 +39,9 @@ StreamingImageVirtualWriter<TInputImage>
::StreamingImageVirtualWriter()
: m_NumberOfDivisions(0),
m_CurrentDivision(0),
m_DivisionProgress(0.0)
m_DivisionProgress(0.0),
m_IsObserving(true),
m_ObserverID(0)
{
// By default, we use tiled streaming, with automatic tile size
// We don't set any parameter, so the memory size is retrieved from the OTB configuration options
......@@ -198,6 +200,8 @@ StreamingImageVirtualWriter<TInputImage>
*/
// Get the source process object
itk::ProcessObject* source = inputPtr->GetSource();
m_IsObserving = false;
m_ObserverID = 0;
// Check if source exists
if(source)
......@@ -208,7 +212,8 @@ StreamingImageVirtualWriter<TInputImage>
CommandPointerType command = CommandType::New();
command->SetCallbackFunction(this, &Self::ObserveSourceFilterProgress);
source->AddObserver(itk::ProgressEvent(), command);
m_ObserverID = source->AddObserver(itk::ProgressEvent(), command);
m_IsObserving = true;
}
else
{
......@@ -243,6 +248,12 @@ StreamingImageVirtualWriter<TInputImage>
// Notify end event observers
this->InvokeEvent(itk::EndEvent());
if (m_IsObserving)
{
m_IsObserving = false;
source->RemoveObserver(m_ObserverID);
}
/**
* Now we have to mark the data as up to data.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment