- Fix crash when QGraphicsItem destructor deletes other QGraphicsItem

(kde-qt cec34b01)
- Fix a crash in KDE/Plasma with QGraphicsView. TopLevel list of items
    (kde-qt 63839f0c)
This commit is contained in:
Rex Dieter 2010-01-09 23:23:28 +00:00
parent 34eafd78f9
commit 0dd2558f3b
4 changed files with 89 additions and 3 deletions

View File

@ -0,0 +1,43 @@
From 63839f0ca3836995cda2fb94cf7dd724d6f6ca52 Mon Sep 17 00:00:00 2001
From: Alexis Menard <alexis.menard@nokia.com>
Date: Thu, 26 Nov 2009 13:47:34 +0100
Subject: [PATCH] Fix a crash in KDE/Plasma with QGraphicsView. TopLevel list of items
was corrupted.
This nasty bug was triggered when the index sort the top level list of
items. We forgot to set the flag topLevelSequentialOrdering to false
so when an item was removed from the top level list it was using the
sibling index which can be not valid anymore since the list is not
sorted by sequential order. So it let some dangling pointers in the
list which make processDirtyItemRecursive crash the next paint event.
Reviewed-by:bnilsen
Reviewed-by:andreas
(cherry picked from commit 705880f0045ac39140f980d69aec68869213e379)
---
src/gui/graphicsview/qgraphicsscene_p.h | 3 +-
tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 32 ++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index b236c40..7d5316f 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -78,7 +78,7 @@ class QGraphicsSceneIndex;
class QGraphicsView;
class QGraphicsWidget;
-class QGraphicsScenePrivate : public QObjectPrivate
+class Q_AUTOTEST_EXPORT QGraphicsScenePrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QGraphicsScene)
public:
@@ -266,6 +266,7 @@ public:
{
if (needSortTopLevelItems) {
qSort(topLevelItems.begin(), topLevelItems.end(), qt_notclosestLeaf);
+ topLevelSequentialOrdering = false;
needSortTopLevelItems = false;
}
}

View File

@ -0,0 +1,29 @@
From cec34b01f2c797475245e9416bbcce6b69a4cb38 Mon Sep 17 00:00:00 2001
From: Olivier Goffart <ogoffart@trolltech.com>
Date: Fri, 4 Dec 2009 11:12:01 +0100
Subject: [PATCH] Fix crash when QGraphicsItem destructor deletes other QGraphicsItem
Same fix as e7a10b00be3e4aa197900ecf424e6d44b07248ae
Reviewed-by: Alexis
---
src/gui/graphicsview/qgraphicsitem.cpp | 4 ++--
tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 7794da6..11bb01b 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1347,8 +1347,8 @@ QGraphicsItem::~QGraphicsItem()
}
if (!d_ptr->children.isEmpty()) {
- QList<QGraphicsItem *> oldChildren = d_ptr->children;
- qDeleteAll(oldChildren);
+ while (!d_ptr->children.isEmpty())
+ delete d_ptr->children.first();
Q_ASSERT(d_ptr->children.isEmpty());
}

View File

@ -1,6 +1,6 @@
# quick-n-dirty method to fetch patches from -patched git branch
# unfortunately, requires an already checked-out copy of the git repo
# when switching branches, use something like: git checkout --track -b remotes/origin/4.6-stable-patched
git format-patch --output-directory kde-qt-patches v4.6.0-beta1..origin/4.6-stable-patched
# when switching branches, use something like: git checkout --track remotes/origin/4.6-stable-patched
git format-patch --output-directory kde-qt-patches v4.6.0..origin/4.6-stable-patched

16
qt.spec
View File

@ -13,7 +13,7 @@ Summary: Qt toolkit
Name: qt
Epoch: 1
Version: 4.6.0
Release: 3%{?dist}
Release: 4%{?dist}
# See LGPL_EXCEPTIONS.txt, LICENSE.GPL3, respectively, for exception details
License: LGPLv2 with exceptions or GPLv3 with exceptions
@ -76,6 +76,14 @@ Patch210: 0010-Fix-error-line-not-to-have-a-as-it-s-not-correct.patch
Patch211: 0011-Fill-gap-of-X.org-XFree-multimedia-special-launcher-.patch
Patch212: 0012-Add-context-to-tr-calls-in-QShortcut.patch
Patch213: 0013-Fix-QNativeImage-constructor.patch
# http://qt.gitorious.org/qt/kde-qt/commit/cec34b01f2c797475245e9416bbcce6b69a4cb38
#Patch214: http://qt.gitorious.org/+kde-developers/qt/kde-qt/commit/cec34b01f2c797475245e9416bbcce6b69a4cb38.patch
# above edited to omit tests/ portion
Patch214: cec34b01f2c797475245e9416bbcce6b69a4cb38.patch
#Patch215: http://qt.gitorious.org/+kde-developers/qt/kde-qt/commit/63839f0ca3836995cda2fb94cf7dd724d6f6ca52.patch
# above edited to omit tests/ portion
Patch215: 63839f0ca3836995cda2fb94cf7dd724d6f6ca52.patch
Source10: http://gstreamer.freedesktop.org/data/images/artwork/gstreamer-logo.svg
Source11: hi16-phonon-gstreamer.png
@ -427,6 +435,8 @@ Qt libraries used for drawing widgets and OpenGL items.
#patch211 -p1 -b .kde-qt-0011
%patch212 -p1 -b .kde-qt-0012
#patch213 -p1 -b .kde-qt-0013
#patch214 -p1 -b .kde-qt-214
%patch215 -p1 -b .kde-qt-215
# drop -fexceptions from $RPM_OPT_FLAGS
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed 's|-fexceptions||g'`
@ -1014,6 +1024,10 @@ fi
%changelog
* Sat Jan 09 2010 Rex Dieter <rdieter@fedoraproject.org> - 4.3.0-4
- Fix crash when QGraphicsItem destructor deletes other QGraphicsItem (kde-qt cec34b01)
- Fix a crash in KDE/Plasma with QGraphicsView. TopLevel list of items (kde-qt 63839f0c)
* Wed Dec 23 2009 Kevin Kofler <Kevin@tigcc.ticalc.org> - 4.6.0-3
- disable QtWebKit JavaScript JIT again, incompatible with SELinux (#549994)