Commit 1a2c68cc authored by Alexander Wiebel's avatar Alexander Wiebel

[FIX #455] for if found before erase

parent fd6d98bb
......@@ -139,6 +139,9 @@ void WROI::removeChangeNotifier( boost::shared_ptr< boost::function< void() > >
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
std::list< boost::shared_ptr< boost::function< void() > > >::iterator it;
it = std::find( m_changeNotifiers.begin(), m_changeNotifiers.end(), notifier );
m_changeNotifiers.erase( it );
if( it != m_changeNotifiers.end() )
{
m_changeNotifiers.erase( it );
}
lock.unlock();
}
......@@ -152,6 +152,9 @@ void WRMBranch::removeChangeNotifier( boost::shared_ptr< boost::function< void()
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
std::list< boost::shared_ptr< boost::function< void() > > >::iterator it;
it = std::find( m_changeNotifiers.begin(), m_changeNotifiers.end(), notifier );
m_changeNotifiers.erase( it );
if( it != m_changeNotifiers.end() )
{
m_changeNotifiers.erase( it );
}
lock.unlock();
}
......@@ -168,7 +168,10 @@ void WROIManager::removeAddNotifier( boost::shared_ptr< boost::function< void( o
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
std::list< boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > >::iterator it;
it = std::find( m_addNotifiers.begin(), m_addNotifiers.end(), notifier );
m_addNotifiers.erase( it );
if( it != m_addNotifiers.end() )
{
m_addNotifiers.erase( it );
}
lock.unlock();
}
......@@ -186,7 +189,10 @@ void WROIManager::removeRemoveNotifier( boost::shared_ptr< boost::function< void
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
std::list< boost::shared_ptr< boost::function< void( osg::ref_ptr< WROI > ) > > >::iterator it;
it = std::find( m_removeNotifiers.begin(), m_removeNotifiers.end(), notifier );
m_removeNotifiers.erase( it );
if( it != m_removeNotifiers.end() )
{
m_removeNotifiers.erase( it );
}
lock.unlock();
}
......@@ -204,7 +210,10 @@ void WROIManager::removeRemoveBranchNotifier( boost::shared_ptr< boost::functio
lock = boost::unique_lock< boost::shared_mutex >( m_associatedNotifiersLock );
std::list< boost::shared_ptr< boost::function< void( boost::shared_ptr< WRMBranch > ) > > >::iterator it;
it = std::find( m_removeBranchNotifiers.begin(), m_removeBranchNotifiers.end(), notifier );
m_removeBranchNotifiers.erase( it );
if( it != m_removeBranchNotifiers.end() )
{
m_removeBranchNotifiers.erase( it );
}
lock.unlock();
}
......
Markdown is supported
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