Skip to content

Commit 4ebe4fa

Browse files
committed
Fix crash removing module from python
1 parent 0791efd commit 4ebe4fa

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/Dataflow/Engine/Controller/DynamicPortManager.cc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,11 @@ void DynamicPortManager::connectionAddedNeedToCloneAPort(const SCIRun::Dataflow:
4848
{
4949
if (enabled_)
5050
{
51-
//std::cout << "need to clone a port: " << ConnectionId::create(cd).id_ << std::endl;
52-
/// @todo: assumption: dynamic = input
5351
auto moduleIn = controller_->getNetwork()->lookupModule(cd.in_.moduleId_);
5452
if (moduleIn->getInputPort(cd.in_.portId_)->isDynamic())
5553
{
5654
ModuleBuilder builder;
5755
auto newPortId = builder.cloneInputPort(moduleIn, cd.in_.portId_);
58-
//std::cout << "SIGNALLING ADD: " << moduleIn->get_id() << " /// " << newPortId << std::endl;
5956
portAdded_(moduleIn->get_id(), newPortId);
6057
}
6158
}
@@ -65,16 +62,16 @@ void DynamicPortManager::connectionRemovedNeedToRemoveAPort(const SCIRun::Datafl
6562
{
6663
if (enabled_)
6764
{
68-
//std::cout << "need to remove a port: " << id.id_ << std::endl;
6965
auto desc = id.describe();
7066
auto moduleIn = controller_->getNetwork()->lookupModule(desc.in_.moduleId_);
71-
//std::cout << "REMOVE CHECKING: " << desc.in_.moduleId_ << " /// " << desc.in_.portId_ << std::endl;
72-
if (moduleIn->getInputPort(desc.in_.portId_)->isDynamic())
67+
if (moduleIn)
7368
{
74-
ModuleBuilder builder;
75-
builder.removeInputPort(moduleIn, desc.in_.portId_);
76-
//std::cout << "SIGNALLING REMOVE: " << moduleIn->get_id() << " /// " << desc.in_.portId_ << std::endl;
77-
portRemoved_(moduleIn->get_id(), desc.in_.portId_);
69+
if (moduleIn->getInputPort(desc.in_.portId_)->isDynamic())
70+
{
71+
ModuleBuilder builder;
72+
builder.removeInputPort(moduleIn, desc.in_.portId_);
73+
portRemoved_(moduleIn->get_id(), desc.in_.portId_);
74+
}
7875
}
7976
}
8077
}

0 commit comments

Comments
 (0)