summaryrefslogtreecommitdiff
path: root/debian/patches/0262-fix-treeview-animation-crash.diff
blob: e307f3afef3d921f9ec5022612476b4040485ccd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Trolltech task ID : 236454
bugs.kde.org number : 176045
applied: no
author: Olivier Goffart

This patch makes sure no deleted items are being accessed during an animation of the treeview
It will also be contained in the upcoming Qt snapshots
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -2815,10 +2815,9 @@ void QTreeViewPrivate::expand(int item, 
     q->setState(oldState);
 
     if (emitSignal) {
+        emit q->expanded(index);
         if (animationsEnabled)
             beginAnimatedOperation();
-        else
-            emit q->expanded(index);
     }
     if (model->canFetchMore(index))
         model->fetchMore(index);
@@ -2858,10 +2857,9 @@ void QTreeViewPrivate::collapse(int item
     q->setState(oldState);
 
     if (emitSignal) {
+        emit q->collapsed(modelIndex);
         if (animationsEnabled)
             beginAnimatedOperation();
-        else
-            emit q->collapsed(modelIndex);
     }
 
     _q_forceColumnResizeToFitContents();
@@ -2918,10 +2916,6 @@ void QTreeViewPrivate::_q_endAnimatedOpe
     animatedOperation.before = QPixmap();
     animatedOperation.after = QPixmap();
     q->setState(QAbstractItemView::NoState);
-    if (animatedOperation.type == AnimatedOperation::Expand)
-        emit q->expanded(viewItems.at(animatedOperation.item).index);
-    else // operation == AnimatedOperation::Collapse
-        emit q->collapsed(viewItems.at(animatedOperation.item).index);
     q->updateGeometries();
     viewport->update();
 }