diff options
author | Stanislav Ionascu <stanislav.ionascu@nokia.com> | 2010-06-28 13:02:08 +0300 |
---|---|---|
committer | Jörgen Scheibengruber <jorgen.scheibengruber@nokia.com> | 2010-06-30 14:01:23 +0300 |
commit | 9d82f54d669d85c703a8e007afff2430038e5f32 (patch) | |
tree | 31adb8d342120112d04a0f50803641dcadfcd7fa | |
parent | 96baf25bab5bafd74a79ad3d98c6b9b410cef317 (diff) |
Changes: Fix a crash situation in ApplicationLayoutDirectionChange propagation loop.
RevBy: Jörgen, Stanislav
Details: If an scene item is destroyed (deleted) from scene on layout direction change,
then the application would crash as the iterator would become invalid.
The fix makes a snapshot of current scene elements and starts to propagate the event,
veryfing that each item still exists in scene.
-rw-r--r-- | src/corelib/widgets/mwindow.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/widgets/mwindow.cpp b/src/corelib/widgets/mwindow.cpp index 05397b75..1bc3fe3a 100644 --- a/src/corelib/widgets/mwindow.cpp +++ b/src/corelib/widgets/mwindow.cpp @@ -968,8 +968,9 @@ bool MWindow::event(QEvent *event) QList<QGraphicsItem *> items = scene()->items(); // call setLayoutDirection_helper() for all top-level items - foreach(QGraphicsItem * item, items) { - if (!item->parentItem()) { + for (int i = 0; i < items.size(); i++) { + QGraphicsItem *item = items.at(i); + if (scene()->items().contains(item) && !item->parentItem()) { d->handleApplicationLayoutDirectionChangeEvent(item); } } |