summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qwidgetanimator.cpp
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-10-22 14:19:24 +1000
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-25 12:18:15 +0200
commit33214af3784feacb2d5188bbf07da92f45f582f9 (patch)
tree8057817307511c2481a79c755d180153ed5c6460 /src/widgets/widgets/qwidgetanimator.cpp
parent82cb34b05f59b3e3f2d641304381ea9d359bc67b (diff)
Fixed crash on destruction of animating QDockWidget in a QMainWindow
It doesn't make sense to hold an unguarded pointer to a QPropertyAnimation while assigning ownership of that animation to the animated widget. Destruction of the widget while the animation is in progress causes the animation pointer to become dangling; then the widget is removed from the containing QMainWindowLayout, which attempts to abort the animation, dereferencing the invalid pointer. The crash can be reproduced sometimes with tst_QDockWidget::taskQTBUG_2940_resizeAfterUndocking (which is in Qt4 only). Change-Id: I758bf7193b2ea39cd4d8e87197d8ff957d3368eb Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Diffstat (limited to 'src/widgets/widgets/qwidgetanimator.cpp')
-rw-r--r--src/widgets/widgets/qwidgetanimator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/widgets/qwidgetanimator.cpp b/src/widgets/widgets/qwidgetanimator.cpp
index edd9d63081..aef967bd65 100644
--- a/src/widgets/widgets/qwidgetanimator.cpp
+++ b/src/widgets/widgets/qwidgetanimator.cpp
@@ -59,7 +59,9 @@ void QWidgetAnimator::abort(QWidget *w)
return;
QPropertyAnimation *anim = *it;
m_animation_map.erase(it);
- anim->stop();
+ if (anim) {
+ anim->stop();
+ }
#ifndef QT_NO_MAINWINDOW
m_mainWindowLayout->animationFinished(w);
#endif