Commit 29fa100b by Sebastian Eichelbaum

[CHANGE] - now also module containers get deleted after removal

parent a81bc072
......@@ -60,6 +60,8 @@ QAction* WQtToolBar::addWidget( QWidget* widget )
void WQtToolBar::clearButtons()
{
clear();
// iterate all items and delete them
for ( std::list< QWidget* >::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it )
{
......@@ -68,7 +70,6 @@ void WQtToolBar::clearButtons()
// clear the lists
m_widgets.clear();
clear();
// The following prevents the bar from changing size when it has no real buttons.
QPushButton* dummyButton = new QPushButton;
......
......@@ -280,6 +280,8 @@ bool WQtDatasetBrowser::event( QEvent* event )
++it;
}
return true;
}
return QDockWidget::event( event );
......
......@@ -104,7 +104,7 @@ unsigned int WModuleConnector::isConnected()
void WModuleConnector::connect( boost::shared_ptr<WModuleConnector> con )
{
boost::shared_ptr< WModule > module = m_module;//.lock(); // it is "unlocked" at the end of this function as "module" looses its scope
boost::shared_ptr< WModule > module = m_module.lock(); // it is "unlocked" at the end of this function as "module" looses its scope
boost::shared_ptr< WModuleContainer > container = module->getAssociatedContainer();
std::string containerName = container.get() ? container->getName() : "Unknown";
WLogger::getLogger()->addLogMessage( "Connecting " + con->getCanonicalName() + " with " + getCanonicalName(),
......@@ -205,7 +205,7 @@ boost::signals2::connection WModuleConnector::subscribeSignal( MODULE_CONNECTOR_
const t_GenericSignalHandlerType WModuleConnector::getSignalHandler( MODULE_CONNECTOR_SIGNAL signal )
{
// the module instance knows that
boost::shared_ptr< WModule > module = m_module;//.lock(); // it is "unlocked" at the end of this function as "module" looses its scope
boost::shared_ptr< WModule > module = m_module.lock(); // it is "unlocked" at the end of this function as "module" looses its scope
return module->getSignalHandler( signal );
}
......
......@@ -205,7 +205,7 @@ protected:
/**
* The Module this connector belongs to
*/
boost::shared_ptr< WModule > m_module;
boost::weak_ptr< WModule > m_module;
/**
* The name of the module owning this connector.
......
......@@ -243,7 +243,7 @@ void WModuleContainer::stop()
WLogger::getLogger()->addLogMessage( "Waiting for module \"" + ( *listIter )->getName() + "\" to finish." ,
"ModuleContainer (" + getName() + ")", LL_INFO );
( *listIter )->wait( true );
( *listIter )->cleanup();
( *listIter )->setAssociatedContainer( boost::shared_ptr< WModuleContainer >() ); // remove last refs to this container inside the module
}
m_moduleAccess->endRead();
......
......@@ -263,12 +263,12 @@ std::vector< boost::shared_ptr< WApplyPrototypeCombiner > > WModuleFactory::getC
return compatibles;
}
if ( cons.size() > 1 )
{
wlog::warn( "ModuleFactory" ) << "Can not find compatibles for " << module->getName() << " module (more than 1 output connector). Using "
<< ( *cons.begin() )->getCanonicalName()
<< " for compatibility check.";
}
// if ( cons.size() > 1 )
// {
// wlog::warn( "ModuleFactory" ) << "Can not find compatibles for " << module->getName() << " module (more than 1 output connector). Using "
// << ( *cons.begin() )->getCanonicalName()
// << " for compatibility check.";
//}
// go through every prototype
for( std::set< boost::shared_ptr< WModule > >::iterator listIter = m_prototypes.begin(); listIter != m_prototypes.end(); ++listIter )
......@@ -281,12 +281,12 @@ std::vector< boost::shared_ptr< WApplyPrototypeCombiner > > WModuleFactory::getC
{
continue;
}
if ( pcons.size() > 1 )
{
wlog::warn( "ModuleFactory" ) << "Can not find compatibles for " << ( *listIter )->getName()
<< " module (more than 1 input connector). Using "
<< ( *pcons.begin() )->getCanonicalName() << " for compatibility check.";
}
// if ( pcons.size() > 1 )
// {
// wlog::warn( "ModuleFactory" ) << "Can not find compatibles for " << ( *listIter )->getName()
// << " module (more than 1 input connector). Using "
// << ( *pcons.begin() )->getCanonicalName() << " for compatibility check.";
// }
// check whether the outputs are compatible with the inputs of the prototypes
if( ( *cons.begin() )->connectable( *pcons.begin() ) && ( *pcons.begin() )->connectable( *cons.begin() ) )
......
......@@ -400,7 +400,7 @@ void WModuleProjectFileCombiner::save( std::ostream& output ) // NOLINT
iciter != ( *citer )->m_connected.end(); ++iciter )
{
// as the module is a weak_ptr -> lock and get access to it
boost::shared_ptr< WModule > theOtherModule = ( *iciter )->m_module;//.lock();
boost::shared_ptr< WModule > theOtherModule = ( *iciter )->m_module.lock();
output << "CONNECTION:(" << moduleToIDMap[ ( *iter ) ] << "," << ( *citer )->getName() << ")->(" <<
moduleToIDMap[ theOtherModule ] << "," << ( *iciter )->getName() << ")" << std::endl;
}
......
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