diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2011-08-30 08:34:31 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-08-30 10:17:16 (GMT) |
commit | e95de30977291a251660f72baa84b5ff244711fb (patch) | |
tree | 8be24a45e6b9623590361308ab29bb694eb61e1f /tests/auto/qshortcut | |
parent | fc87ef723d5a030fd701257eeca471e450e08fbb (diff) | |
download | Qt-e95de30977291a251660f72baa84b5ff244711fb.zip Qt-e95de30977291a251660f72baa84b5ff244711fb.tar.gz Qt-e95de30977291a251660f72baa84b5ff244711fb.tar.bz2 |
don't crash when destroying the shortcuts
as shortcutDestroyed(..) modifies the shortcuts list.
disconnect from shortcutDestroyed() first, or operate on a detach()-ed list
this was uncovered by QList::removaAll() optimization patch.
Diffstat (limited to 'tests/auto/qshortcut')
-rw-r--r-- | tests/auto/qshortcut/tst_qshortcut.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/auto/qshortcut/tst_qshortcut.cpp b/tests/auto/qshortcut/tst_qshortcut.cpp index a78e8cf..d761b19 100644 --- a/tests/auto/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/qshortcut/tst_qshortcut.cpp @@ -1124,7 +1124,8 @@ void tst_QShortcut::context() // ------------------------------------------------------------------ void tst_QShortcut::clearAllShortcuts() { - qDeleteAll(shortcuts); + QList<QShortcut *> shortcutsCpy = shortcuts; + qDeleteAll(shortcutsCpy); shortcuts.clear(); } |