updated on Fri Jan 20 20:16:25 UTC 2012
[aur-mirror.git] / qt-systemtrayicon / qtbug-16292.patch
blob9728e28f50ab27a6e611d26a2129a51fc06aad08
1 From e340844bd614add505a39a3a6b915632476f6305 Mon Sep 17 00:00:00 2001
2 From: Gabriel de Dietrich <gabriel.dietrich-de@nokia.com>
3 Date: Tue, 15 Feb 2011 11:19:26 +0100
4 Subject: [PATCH] Fix crash in KPackageKit
6 QTreeViewPrivate::itemHeight() may refer to an invalid QModelIndex
7 after calling QTreeView::indexRowSizeHint().
9 Same thing inside QTreeView::indexRowSizeHint(), since
10 QHeaderView::count() will call
11 QAbstractItemViewPrivate::executePostedLayout() which may invalidate
12 all the QModelIndex.
14 Reviewed-by: Olivier
15 Task-number: QTBUG-16292
16 ---
17 src/gui/itemviews/qtreeview.cpp | 11 ++++++-----
18 1 files changed, 6 insertions(+), 5 deletions(-)
20 diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
21 index f1f3236..c0573bb 100644
22 --- a/src/gui/itemviews/qtreeview.cpp
23 +++ b/src/gui/itemviews/qtreeview.cpp
24 @@ -2753,6 +2753,7 @@ int QTreeView::indexRowSizeHint(const QModelIndex &index) const
26 int start = -1;
27 int end = -1;
28 + int indexRow = index.row();
29 int count = d->header->count();
30 bool emptyHeader = (count == 0);
31 QModelIndex parent = index.parent();
32 @@ -2789,7 +2790,7 @@ int QTreeView::indexRowSizeHint(const QModelIndex &index) const
33 int logicalColumn = emptyHeader ? column : d->header->logicalIndex(column);
34 if (d->header->isSectionHidden(logicalColumn))
35 continue;
36 - QModelIndex idx = d->model->index(index.row(), logicalColumn, parent);
37 + QModelIndex idx = d->model->index(indexRow, logicalColumn, parent);
38 if (idx.isValid()) {
39 QWidget *editor = d->editorForIndex(idx).editor;
40 if (editor && d->persistent.contains(editor)) {
41 @@ -3224,14 +3225,14 @@ int QTreeViewPrivate::itemHeight(int item) const
42 if (viewItems.isEmpty())
43 return 0;
44 const QModelIndex &index = viewItems.at(item).index;
45 + if (!index.isValid())
46 + return 0;
47 int height = viewItems.at(item).height;
48 - if (height <= 0 && index.isValid()) {
49 + if (height <= 0) {
50 height = q_func()->indexRowSizeHint(index);
51 viewItems[item].height = height;
53 - if (!index.isValid() || height < 0)
54 - return 0;
55 - return height;
56 + return qMax(height, 0);
60 --
61 1.6.1