1 |
dilfridge 11/11/12 21:12:10 |
2 |
|
3 |
Added: plasma-workspace-4.7.3-taskcrash.patch |
4 |
Log: |
5 |
Add another upstream plasma crash fix, kde-bug 272495 |
6 |
|
7 |
(Portage version: 2.1.10.34/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 kde-base/plasma-workspace/files/plasma-workspace-4.7.3-taskcrash.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/kde-base/plasma-workspace/files/plasma-workspace-4.7.3-taskcrash.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/kde-base/plasma-workspace/files/plasma-workspace-4.7.3-taskcrash.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: plasma-workspace-4.7.3-taskcrash.patch |
16 |
=================================================================== |
17 |
commit 639155a5493a28ca9460d60fa0c078ec65c3bb96 |
18 |
Author: Aaron Seigo <aseigo@×××.org> |
19 |
Date: Thu Nov 10 13:01:37 2011 +0100 |
20 |
|
21 |
use a QWeakPointer to track the lifespan of the task |
22 |
|
23 |
the itemRemoved signal from TaskGroup has dangling pointers, apparently |
24 |
by design (the next thing on my list to investigate), and the signal is |
25 |
delayed. so between the actual deletion of the task and the signal, there |
26 |
pointer is a dangler. easy solution is to just track it in the WindowTaskItem |
27 |
itself with a cheap QWeakPointer. |
28 |
|
29 |
BUG:272495 |
30 |
|
31 |
diff --git a/plasma/desktop/applets/tasks/abstracttaskitem.cpp b/plasma/desktop/applets/tasks/abstracttaskitem.cpp |
32 |
index 00140ef..48ba172 100644 |
33 |
--- a/plasma/desktop/applets/tasks/abstracttaskitem.cpp |
34 |
+++ b/plasma/desktop/applets/tasks/abstracttaskitem.cpp |
35 |
@@ -203,6 +203,10 @@ QIcon AbstractTaskItem::icon() const |
36 |
return QIcon(); |
37 |
} |
38 |
|
39 |
+void AbstractTaskItem::close() |
40 |
+{ |
41 |
+} |
42 |
+ |
43 |
void AbstractTaskItem::setTaskFlags(const TaskFlags flags) |
44 |
{ |
45 |
if (((m_flags & TaskWantsAttention) != 0) != ((flags & TaskWantsAttention) != 0)) { |
46 |
diff --git a/plasma/desktop/applets/tasks/abstracttaskitem.h b/plasma/desktop/applets/tasks/abstracttaskitem.h |
47 |
index 9520e1f..a527881 100644 |
48 |
--- a/plasma/desktop/applets/tasks/abstracttaskitem.h |
49 |
+++ b/plasma/desktop/applets/tasks/abstracttaskitem.h |
50 |
@@ -103,7 +103,7 @@ public: |
51 |
/** Returns the current icon for this task. */ |
52 |
QIcon icon() const; |
53 |
|
54 |
- virtual void close() = 0; |
55 |
+ virtual void close(); |
56 |
|
57 |
/** Tells the window manager the minimized task's geometry. */ |
58 |
virtual void publishIconGeometry() const; |
59 |
diff --git a/plasma/desktop/applets/tasks/windowtaskitem.cpp b/plasma/desktop/applets/tasks/windowtaskitem.cpp |
60 |
index 1ddca2c..1c33476 100644 |
61 |
--- a/plasma/desktop/applets/tasks/windowtaskitem.cpp |
62 |
+++ b/plasma/desktop/applets/tasks/windowtaskitem.cpp |
63 |
@@ -56,7 +56,6 @@ |
64 |
|
65 |
WindowTaskItem::WindowTaskItem(QGraphicsWidget *parent, Tasks *applet) |
66 |
: AbstractTaskItem(parent, applet), |
67 |
- m_task(0), |
68 |
m_busyWidget(0) |
69 |
{ |
70 |
} |
71 |
@@ -77,8 +76,8 @@ void WindowTaskItem::activate() |
72 |
// in a widget such as a line edit which does accept the focus) |
73 |
// this needs to be implemented for Plasma's own panels. |
74 |
//kDebug(); |
75 |
- if (m_task && m_task->task()) { |
76 |
- m_task->task()->activateRaiseOrIconify(); |
77 |
+ if (m_task && m_task.data()->task()) { |
78 |
+ m_task.data()->task()->activateRaiseOrIconify(); |
79 |
// emit windowSelected(this); |
80 |
} |
81 |
} |
82 |
@@ -108,27 +107,20 @@ void WindowTaskItem::keyPressEvent(QKeyEvent *event) |
83 |
} |
84 |
} |
85 |
|
86 |
-//destroy this item |
87 |
-void WindowTaskItem::close() |
88 |
-{ |
89 |
- //kDebug(); |
90 |
- m_task = 0; |
91 |
-} |
92 |
- |
93 |
void WindowTaskItem::publishIconGeometry() const |
94 |
{ |
95 |
- if (!m_task || !m_task->task()) { |
96 |
+ if (!m_task || !m_task.data()->task()) { |
97 |
return; |
98 |
} |
99 |
|
100 |
QRect rect = iconGeometry(); |
101 |
- m_task->task()->publishIconGeometry(rect); |
102 |
+ m_task.data()->task()->publishIconGeometry(rect); |
103 |
} |
104 |
|
105 |
void WindowTaskItem::publishIconGeometry(const QRect &rect) const |
106 |
{ |
107 |
- if (m_task && m_task->task()) { |
108 |
- m_task->task()->publishIconGeometry(rect); |
109 |
+ if (m_task && m_task.data()->task()) { |
110 |
+ m_task.data()->task()->publishIconGeometry(rect); |
111 |
} |
112 |
} |
113 |
|
114 |
@@ -142,7 +134,7 @@ void WindowTaskItem::updateTask(::TaskManager::TaskChanges changes) |
115 |
TaskFlags flags = m_flags; |
116 |
|
117 |
if (changes & TaskManager::StateChanged) { |
118 |
- if (m_task->isActive()) { |
119 |
+ if (m_task.data()->isActive()) { |
120 |
flags |= TaskHasFocus; |
121 |
if (!(m_flags & TaskHasFocus)) { |
122 |
emit activated(this); |
123 |
@@ -151,7 +143,7 @@ void WindowTaskItem::updateTask(::TaskManager::TaskChanges changes) |
124 |
flags &= ~TaskHasFocus; |
125 |
} |
126 |
|
127 |
- if (m_task->isMinimized()) { |
128 |
+ if (m_task.data()->isMinimized()) { |
129 |
flags |= TaskIsMinimized; |
130 |
} else { |
131 |
flags &= ~TaskIsMinimized; |
132 |
@@ -160,7 +152,7 @@ void WindowTaskItem::updateTask(::TaskManager::TaskChanges changes) |
133 |
} |
134 |
|
135 |
if (changes & TaskManager::AttentionChanged) { |
136 |
- if (m_task->demandsAttention()) { |
137 |
+ if (m_task.data()->demandsAttention()) { |
138 |
flags |= TaskWantsAttention; |
139 |
} else { |
140 |
flags &= ~TaskWantsAttention; |
141 |
@@ -191,14 +183,14 @@ void WindowTaskItem::updateTask(::TaskManager::TaskChanges changes) |
142 |
|
143 |
if (needsUpdate) { |
144 |
//redraw |
145 |
- //kDebug() << m_task->name(); |
146 |
+ //kDebug() << m_task.data()->name(); |
147 |
queueUpdate(); |
148 |
} |
149 |
} |
150 |
|
151 |
void WindowTaskItem::updateToolTip() |
152 |
{ |
153 |
- if (!m_task || !m_task->task()) { |
154 |
+ if (!m_task || !m_task.data()->task()) { |
155 |
return; |
156 |
} |
157 |
|
158 |
@@ -219,19 +211,19 @@ void WindowTaskItem::updateToolTip() |
159 |
} |
160 |
|
161 |
if (showToolTip) { |
162 |
- QPixmap p = m_task->task()->icon(KIconLoader::SizeLarge, KIconLoader::SizeLarge, false); |
163 |
+ QPixmap p = m_task.data()->task()->icon(KIconLoader::SizeLarge, KIconLoader::SizeLarge, false); |
164 |
if (p.height() > KIconLoader::SizeLarge) { |
165 |
p = p.scaled(QSize(KIconLoader::SizeLarge, KIconLoader::SizeLarge), |
166 |
Qt::KeepAspectRatio, Qt::SmoothTransformation); |
167 |
} |
168 |
|
169 |
- Plasma::ToolTipContent data(Qt::escape(m_task->name()), QString(), p); |
170 |
- if (m_task->desktop() != 0 && |
171 |
- (!m_applet->groupManager().showOnlyCurrentDesktop() || !m_task->isOnCurrentDesktop())) { |
172 |
+ Plasma::ToolTipContent data(Qt::escape(m_task.data()->name()), QString(), p); |
173 |
+ if (m_task.data()->desktop() != 0 && |
174 |
+ (!m_applet->groupManager().showOnlyCurrentDesktop() || !m_task.data()->isOnCurrentDesktop())) { |
175 |
data.setSubText(i18nc("Which virtual desktop a window is currently on", "On %1", |
176 |
- KWindowSystem::desktopName(m_task->desktop()))); |
177 |
+ KWindowSystem::desktopName(m_task.data()->desktop()))); |
178 |
} |
179 |
- data.setWindowToPreview(m_task->task()->window()); |
180 |
+ data.setWindowsToPreview(QList<WId>() << m_task.data()->task()->window()); |
181 |
data.setClickable(true); |
182 |
data.setInstantPopup(true); |
183 |
data.setHighlightWindows(m_applet->highlightWindows()); |
184 |
@@ -285,8 +277,9 @@ void WindowTaskItem::gotTaskPointer() |
185 |
void WindowTaskItem::setWindowTask(TaskManager::TaskItem* taskItem) |
186 |
{ |
187 |
if (m_task) { |
188 |
- disconnect(m_task->task().constData(), 0, this, 0); |
189 |
+ disconnect(m_task.data()->task().constData(), 0, this, 0); |
190 |
} |
191 |
+ |
192 |
m_task = taskItem; |
193 |
m_abstractItem = qobject_cast<TaskManager::AbstractGroupableItem *>(taskItem); |
194 |
|
195 |
@@ -294,8 +287,10 @@ void WindowTaskItem::setWindowTask(TaskManager::TaskItem* taskItem) |
196 |
connect(m_abstractItem, SIGNAL(destroyed(QObject*)), this, SLOT(clearAbstractItem())); |
197 |
} |
198 |
|
199 |
- connect(m_task, SIGNAL(changed(::TaskManager::TaskChanges)), |
200 |
- this, SLOT(updateTask(::TaskManager::TaskChanges))); |
201 |
+ if (m_task) { |
202 |
+ connect(m_task.data(), SIGNAL(changed(::TaskManager::TaskChanges)), |
203 |
+ this, SLOT(updateTask(::TaskManager::TaskChanges))); |
204 |
+ } |
205 |
|
206 |
updateTask(::TaskManager::EverythingChanged); |
207 |
publishIconGeometry(); |
208 |
@@ -319,7 +314,7 @@ void WindowTaskItem::setTask(TaskManager::TaskItem* taskItem) |
209 |
|
210 |
TaskManager::TaskPtr WindowTaskItem::windowTask() const |
211 |
{ |
212 |
- return m_task ? m_task->task() : TaskManager::TaskPtr(); |
213 |
+ return m_task ? m_task.data()->task() : TaskManager::TaskPtr(); |
214 |
} |
215 |
|
216 |
void WindowTaskItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) |
217 |
@@ -331,10 +326,10 @@ void WindowTaskItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) |
218 |
|
219 |
QList <QAction*> actionList; |
220 |
QAction *a(0); |
221 |
- if (m_task->isGrouped()) { |
222 |
+ if (m_task.data()->isGrouped()) { |
223 |
a = new QAction(i18n("Collapse Parent Group"), 0); |
224 |
actionList.append(a); |
225 |
- TaskGroupItem *group = qobject_cast<TaskGroupItem*>(m_applet->rootGroupItem()->abstractTaskItem(m_task->parentGroup())); |
226 |
+ TaskGroupItem *group = qobject_cast<TaskGroupItem*>(m_applet->rootGroupItem()->abstractTaskItem(m_task.data()->parentGroup())); |
227 |
connect(a, SIGNAL(triggered()), group, SLOT(collapse())); |
228 |
} |
229 |
|
230 |
@@ -343,7 +338,7 @@ void WindowTaskItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) |
231 |
actionList.append(configAction); |
232 |
} |
233 |
|
234 |
- TaskManager::BasicMenu menu(0, m_task, &m_applet->groupManager(), actionList); |
235 |
+ TaskManager::BasicMenu menu(0, m_task.data(), &m_applet->groupManager(), actionList); |
236 |
menu.adjustSize(); |
237 |
|
238 |
if (m_applet->formFactor() != Plasma::Vertical) { |
239 |
@@ -364,18 +359,13 @@ bool WindowTaskItem::isWindowItem() const |
240 |
|
241 |
bool WindowTaskItem::isActive() const |
242 |
{ |
243 |
- if (!m_task) { |
244 |
- //kDebug() << "no task set"; |
245 |
- return false; |
246 |
- } |
247 |
- |
248 |
- return m_task->isActive(); |
249 |
+ return m_task ? m_task.data()->isActive() : false; |
250 |
} |
251 |
|
252 |
void WindowTaskItem::setAdditionalMimeData(QMimeData* mimeData) |
253 |
{ |
254 |
if (m_task) { |
255 |
- m_task->addMimeData(mimeData); |
256 |
+ m_task.data()->addMimeData(mimeData); |
257 |
} |
258 |
} |
259 |
|
260 |
diff --git a/plasma/desktop/applets/tasks/windowtaskitem.h b/plasma/desktop/applets/tasks/windowtaskitem.h |
261 |
index a5b698a..4db9d43 100644 |
262 |
--- a/plasma/desktop/applets/tasks/windowtaskitem.h |
263 |
+++ b/plasma/desktop/applets/tasks/windowtaskitem.h |
264 |
@@ -63,7 +63,6 @@ signals: |
265 |
|
266 |
public slots: |
267 |
void activate(); |
268 |
- void close(); |
269 |
|
270 |
protected: |
271 |
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); |
272 |
@@ -82,7 +81,7 @@ private: |
273 |
/** Sets the window represented by this task. */ |
274 |
void setWindowTask(TaskManager::TaskItem* taskItem); |
275 |
|
276 |
- TaskManager::TaskItem *m_task; |
277 |
+ QWeakPointer<TaskManager::TaskItem> m_task; |
278 |
Plasma::BusyWidget *m_busyWidget; |
279 |
}; |