Commit 6426d475 authored by Robert Frohl's avatar Robert Frohl
Browse files

[FIX] - should fix two segfaults originating in the module graph: visit() and parentItem()

parent 3a8b5c67
......@@ -49,11 +49,8 @@ WQtNetworkArrow::WQtNetworkArrow( WQtNetworkOutputPort *startPort, WQtNetworkInp
WQtNetworkArrow::~WQtNetworkArrow()
{
//std::cout << "arrow delete start\n";
this->hide();
m_startPort->removeArrow( this );
m_endPort->removeArrow( this );
//std::cout << "arrow delete end\n";
}
int WQtNetworkArrow::type() const
......
......@@ -154,6 +154,8 @@ void WQtNetworkEditor::deleteSelectedItems()
ar->getEndPort()->getConnector()->getName() ) );
disconnectCombiner->run();
disconnectCombiner->wait();
ar->hide();
m_scene->removeItem( ar );
}
}
......@@ -162,6 +164,8 @@ void WQtNetworkEditor::deleteSelectedItems()
if( it != 0 )
{
WKernel::getRunningKernel()->getRootContainer()->remove( it->getModule() );
it->hide();
m_scene->removeItem( it );
}
}
itemList.clear();
......@@ -389,7 +393,10 @@ bool WQtNetworkEditor::event( QEvent* event )
{
op->removeArrow( ar );
ip->removeArrow( ar );
m_scene->removeItem( ar );
if( ar->scene() != NULL )
{
m_scene->removeItem( ar );
}
delete ar;
}
else
......@@ -446,7 +453,10 @@ bool WQtNetworkEditor::event( QEvent* event )
if( item != 0 )
{
m_scene->removeItem( item );
if( item->scene() != NULL )
{
m_scene->removeItem( item );
}
m_items.removeAll( item );
delete item;
}
......@@ -504,3 +514,4 @@ void WQtNetworkEditor::timerEvent( QTimerEvent *event )
timerId = 0;
}
}
......@@ -48,7 +48,6 @@ WQtNetworkInputPort::WQtNetworkInputPort( boost::shared_ptr<WModuleInputConnecto
WQtNetworkInputPort::~WQtNetworkInputPort()
{
//std::cout << "in port delete\n";
}
int WQtNetworkInputPort::type() const
......
......@@ -73,7 +73,6 @@ WQtNetworkItem::WQtNetworkItem( WQtNetworkEditor *editor, boost::shared_ptr< WMo
WQtNetworkItem::~WQtNetworkItem()
{
std::cout << "item delete start\n";
foreach( WQtNetworkPort *port, m_inPorts )
{
delete port;
......@@ -83,11 +82,8 @@ WQtNetworkItem::~WQtNetworkItem()
{
delete port;
}
this->hide();
//this->scene()->removeItem( this );
delete m_text;
//delete m_subtitle;
std::cout << "item delete end\n";
}
int WQtNetworkItem::type() const
......
......@@ -48,7 +48,6 @@ WQtNetworkOutputPort::WQtNetworkOutputPort( boost::shared_ptr<WModuleOutputConne
WQtNetworkOutputPort::~WQtNetworkOutputPort()
{
//std::cout << "out port delete\n";
}
int WQtNetworkOutputPort::type() const
......
......@@ -43,8 +43,6 @@ WQtNetworkPort::WQtNetworkPort()
WQtNetworkPort::~WQtNetworkPort()
{
//std::cout << "port delete\n";
this->hide();
removeArrows();
}
......@@ -148,7 +146,7 @@ void WQtNetworkPort::mouseReleaseEvent( QGraphicsSceneMouseEvent *mouseEvent )
// remove current m_line for real connection
scene()->removeItem( m_line );
//delete m_line;
delete m_line;
if( !endItems.isEmpty() &&
!startItems.isEmpty() &&
......
......@@ -40,6 +40,9 @@
WQtNetworkScene::WQtNetworkScene()
: QGraphicsScene()
{
setItemIndexMethod( NoIndex );
// this takes care of the segfault: QGraphicsSceneFindItemBspTreeVisitor::visit
// seems to be a Qt bug, testet with qt4 4.7.0
}
WQtNetworkScene::~WQtNetworkScene()
......@@ -66,3 +69,4 @@ QGraphicsItem* WQtNetworkScene::getFakeItem()
{
return m_fakeItem;
}
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