Commit 51110bc2 authored by Vincent Carrubba's avatar Vincent Carrubba
Browse files

Recode disconnect methods with good use of SimpleObjectReferencer

parent 36c8a053
...@@ -564,14 +564,14 @@ bool EffectNode::disconnectStaticVideoOutput( quint32 nodeId ) ...@@ -564,14 +564,14 @@ bool EffectNode::disconnectStaticVideoOutput( quint32 nodeId )
in = out->getInSlotPtr(); in = out->getInSlotPtr();
if ( out->disconnect() == false ) if ( out->disconnect() == false )
return ( false ); return ( false );
m_connectedStaticVideosOutputs.erase( m_connectedStaticVideosOutputs.find( out->getId() ) ); m_connectedStaticVideosOutputs.delObjectReference( out->getId() );
father = in->getPrivateFather(); father = in->getPrivateFather();
if ( father == m_father ) if ( father == m_father )
father->m_connectedInternalsStaticVideosInputs.erase( father->m_connectedInternalsStaticVideosInputs.find( in->getId() ) ); father->dereferenceInternalStaticVideoInputAsConnected( in->getId() );
else ( father == this )
m_connectedStaticVideosInputs.delObjectReference( in->getId() );
else else
// POTENTIAL RACE-CONDITION father->dereferenceStaticVideoInputAsConnected( in->getId() );
father->m_connectedStaticVideosInputs.erase( father->m_connectedStaticVideosInputs.find( in->getId() ) );
return ( true ); return ( true );
} }
...@@ -587,14 +587,14 @@ bool EffectNode::disconnectStaticVideoOutput( QString const & nodeName ) ...@@ -587,14 +587,14 @@ bool EffectNode::disconnectStaticVideoOutput( QString const & nodeName )
in = out->getInSlotPtr(); in = out->getInSlotPtr();
if ( out->disconnect() == false ) if ( out->disconnect() == false )
return ( false ); return ( false );
m_connectedStaticVideosOutputs.erase( m_connectedStaticVideosOutputs.find( out->getId() ) ); m_connectedStaticVideosOutputs.delObjectReference( out->getId() );
father = in->getPrivateFather(); father = in->getPrivateFather();
if ( father == m_father ) if ( father == m_father )
father->m_connectedInternalsStaticVideosInputs.erase( father->m_connectedInternalsStaticVideosInputs.find( in->getId() ) ); father->dereferenceInternalStaticVideoInputAsConnected( in->getId() );
else ( father == this )
m_connectedStaticVideosInputs.delObjectReference( in->getId() );
else else
// POTENTIAL RACE-CONDITION father->dereferenceStaticVideoInputAsConnected( in->getId() );
father->m_connectedStaticVideosInputs.erase( father->m_connectedStaticVideosInputs.find( in->getId() ) );
return ( true ); return ( true );
} }
...@@ -1414,13 +1414,9 @@ bool EffectNode::disconnectInternalStaticVideoOutput( quint32 nodeId ) ...@@ -1414,13 +1414,9 @@ bool EffectNode::disconnectInternalStaticVideoOutput( quint32 nodeId )
in = out->getInSlotPtr(); in = out->getInSlotPtr();
if ( out->disconnect() == false ) if ( out->disconnect() == false )
return ( false ); return ( false );
m_connectedInternalsStaticVideosOutputs.erase( m_connectedInternalsStaticVideosOutputs.find( out->getId() ) ); m_connectedInternalsStaticVideosOutputs.delObjectReference( out->getId() );
father = in->getPrivateFather(); father = in->getPrivateFather();
if ( father == this ) father->dereferenceStaticVideoInputAsConnected( in->getId() );
m_connectedInternalsStaticVideosInputs.erase( m_connectedInternalsStaticVideosInputs.find( in->getId() ) );
else
// POTENTIAL RACE-CONDITION
father->m_connectedStaticVideosInputs.erase( father->m_connectedStaticVideosInputs.find( in->getId() ) );
return ( true ); return ( true );
} }
...@@ -1436,15 +1432,9 @@ bool EffectNode::disconnectInternalStaticVideoOutput( QString const & nod ...@@ -1436,15 +1432,9 @@ bool EffectNode::disconnectInternalStaticVideoOutput( QString const & nod
in = out->getInSlotPtr(); in = out->getInSlotPtr();
if ( out->disconnect() == false ) if ( out->disconnect() == false )
return ( false ); return ( false );
m_connectedInternalsStaticVideosOutputs.erase( m_connectedInternalsStaticVideosOutputs.find( out->getId() ) ); m_connectedInternalsStaticVideosOutputs.delObjectReference( out->getId() );
father = in->getPrivateFather(); father = in->getPrivateFather();
father->dereferenceStaticVideoInputAsConnected( in->getId() );
if ( father == this )
m_connectedInternalsStaticVideosInputs.erase( m_connectedInternalsStaticVideosInputs.find( in->getId() ) );
else
// POTENTIAL RACE-CONDITION
father->m_connectedStaticVideosInputs.erase( father->m_connectedStaticVideosInputs.find( in->getId() ) );
return ( true ); return ( true );
} }
......
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