From 89d3a9ab9f984e2ef4b12a73677e04873b9a46c3 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Tue, 3 Mar 2015 01:16:30 +0100 Subject: [PATCH] ui: fixed leak in QtGraphView transition --- src/app/qt/view/QtGraphView.cpp | 14 ++++++++------ src/app/qt/view/QtGraphView.h | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/app/qt/view/QtGraphView.cpp b/src/app/qt/view/QtGraphView.cpp index d4bdf9c7..191ee7a0 100644 --- a/src/app/qt/view/QtGraphView.cpp +++ b/src/app/qt/view/QtGraphView.cpp @@ -94,6 +94,8 @@ void QtGraphView::finishedTransition() QGraphicsView* view = getView(); view->setInteractive(true); + m_transition.reset(); + switchToNewGraphData(); } @@ -375,7 +377,7 @@ void QtGraphView::createTransition() QGraphicsView* view = getView(); view->setInteractive(false); - QSequentialAnimationGroup* group = new QSequentialAnimationGroup(); + m_transition = std::make_shared(); // fade out if (vanishingNodes.size() || m_oldEdges.size()) @@ -402,7 +404,7 @@ void QtGraphView::createTransition() vanish->addAnimation(anim); } - group->addAnimation(vanish); + m_transition->addAnimation(vanish); } // move and scale @@ -439,7 +441,7 @@ void QtGraphView::createTransition() } } - group->addAnimation(remain); + m_transition->addAnimation(remain); } // fade in @@ -472,9 +474,9 @@ void QtGraphView::createTransition() edge->setOpacity(0.0f); } - group->addAnimation(appear); + m_transition->addAnimation(appear); } - connect(group, SIGNAL(finished()), this, SLOT(finishedTransition())); - group->start(); + connect(m_transition.get(), SIGNAL(finished()), this, SLOT(finishedTransition())); + m_transition->start(); } diff --git a/src/app/qt/view/QtGraphView.h b/src/app/qt/view/QtGraphView.h index 1cf9ce41..ec4069eb 100644 --- a/src/app/qt/view/QtGraphView.h +++ b/src/app/qt/view/QtGraphView.h @@ -13,6 +13,7 @@ struct DummyEdge; struct DummyNode; class QGraphicsView; +class QSequentialAnimationGroup; class QtGraphEdge; class QtGraphNode; @@ -77,6 +78,7 @@ private: std::list> m_nodes; std::list> m_oldNodes; + std::shared_ptr m_transition; QPointF m_sceneRectOffset; };