Commit c546295e authored by Pascal Monnier's avatar Pascal Monnier
Browse files

See #2522 : Fixed ImageSlice connection.

--HG--
branch : fw4spl_0.9.1
parent b3712239
......@@ -89,6 +89,10 @@ void ImageSlice::doStart() throw(fwTools::Failed)
this->addToRenderer(m_imageActor);
this->addToRenderer(m_planeOutlineActor);
this->addToPicker(m_imageActor);
m_connection = this->getCtrlImage()->signal(::fwData::Object::s_OBJECT_MODIFIED_SIG)->connect(
this->slot(::fwServices::IService::s_RECEIVE_SLOT));
this->doUpdate();
}
//------------------------------------------------------------------------------
......@@ -108,7 +112,12 @@ void ImageSlice::doStop() throw(fwTools::Failed)
void ImageSlice::doSwap() throw(fwTools::Failed)
{
SLM_TRACE_FUNC();
if (!m_connection.expired())
{
m_connection.disconnect();
}
m_connection = this->getCtrlImage()->signal(::fwData::Object::s_OBJECT_MODIFIED_SIG)->connect(
this->slot(::fwServices::IService::s_RECEIVE_SLOT));
this->doUpdate();
}
......@@ -140,14 +149,6 @@ void ImageSlice::doUpdate() throw(::fwTools::Failed)
::fwData::Image::sptr image = this->getCtrlImage();
bool imageIsValid = ::fwComEd::fieldHelper::MedicalImageHelpers::checkImageValidity( image );
if (!m_connection.expired())
{
m_connection.disconnect();
}
m_connection = image->signal(::fwData::Object::s_OBJECT_MODIFIED_SIG)->connect(
this->slot(::fwServices::IService::s_RECEIVE_SLOT));
if (imageIsValid)
{
this->buildPipeline();
......@@ -169,7 +170,16 @@ void ImageSlice::doReceive(::fwServices::ObjectMsg::csptr msg) throw(::fwTools::
|| msg->hasEvent( ::fwComEd::CompositeMsg::REMOVED_KEYS )
)
{
doUpdate();
if (m_ctrlImage.expired() || m_ctrlImage.lock() != this->getCtrlImage())
{
if (!m_connection.expired())
{
m_connection.disconnect();
}
m_connection = m_ctrlImage.lock()->signal(::fwData::Object::s_OBJECT_MODIFIED_SIG)->connect(
this->slot(::fwServices::IService::s_RECEIVE_SLOT));
}
this->doUpdate();
}
if (imageIsValid)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment