[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: Review Request: Workaround Taskbar ghost entries bug
From: "Aaron J. Seigo" <aseigo () kde ! org>
Date: 2011-10-05 9:48:35
Message-ID: 20111005094835.10581.29592 () vidsolbach ! de
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/102779/#review7107
-----------------------------------------------------------
the check makes sense; still wish we knew *where* these odd tasks were coming from \
(my guess is that they are created and then deleted almost immediately somewhere, but \
not before the tasks widget is told about them ..)
in any case, it looks like there is a potential problem with the new'ing of the \
WindowTaskItem when the groupItem is invalid. if you could clear that up and then \
commit, that'd be awesome. thanks for tracking this down! i know how much time and \
effort you poured into this ... many will be thankful.
plasma/desktop/applets/tasks/taskgroupitem.cpp
<http://git.reviewboard.kde.org/r/102779/#comment6235>
looks like a possible memory leak (well, not quite; it's still parented properly) \
due to the WindowTaskItem being new'd but not actually used.
it could be written sth like this instead:
} else {
TaskManager::TaskItem * taskItem = \
static_cast<TaskManager::TaskItem*>(groupableItem);
if (taskItem->startup() || taskItem->task()) {
WindowTaskItem *windowItem = new WindowTaskItem(this, m_applet);
windowItem->setTask(taskItem);
item = windowItem;
}
}
if (!item) {
return 0;
}
- Aaron J. Seigo
On Oct. 5, 2011, 9:26 a.m., Alex Fiestas wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/102779/
> -----------------------------------------------------------
>
> (Updated Oct. 5, 2011, 9:26 a.m.)
>
>
> Review request for Plasma and Aaron J. Seigo.
>
>
> Description
> -------
>
> Well, as some of you may know I have been tracking down the ghost entries bug... \
> this time I have NOT been able to fix the source of the problem but at least after \
> some GDB at BDS I think I have a workaround.
> A Ghost entry happens when a TaskItem is not either a startup or a task, in that \
> case the code that "paints" the task doesn't know what to do but it reserve the \
> space anyway. Currently the code path is like this:
> 1-TaskGruopItem::itemAdded is called
> 2-It calles TaskGruopItem::createAbstractItem
> 3-createAbstractItem takes a GroupableItem and cast it either to a GroupItem, or \
> LauncherItem or TaskItem depending on the ::itemTtype()
> createAbstractItem is prepared to return 0 when an AbstractTaskItem can't be \
> created, and even further WindowTaskItem::setTask is checking if the taskItem is \
> not a startup or a task, the problem is that setTask returns void so we can't \
> really know if the "setting" was succeed or not. In that case, an "empty" \
> WindowTaskItem is returned, being it a ghost entry.
> This workaround what does is check if the taskItem is valid, if it is not 0 is \
> returned.
> This is a workaround since, in theory a TaskItem should ALWAYS be either a startup \
> or a task so we should find the root of the problem instead of adding yet another \
> check. Is precisely this kind of checks that make all *tasks* stack a mess.
>
> Diffs
> -----
>
> plasma/desktop/applets/tasks/taskgroupitem.cpp eec27c2
>
> Diff: http://git.reviewboard.kde.org/r/102779/diff/diff
>
>
> Testing
> -------
>
> I have been using the patch for 3 days playing around with activities and virtual \
> desktops, so far so good.
>
> Thanks,
>
> Alex Fiestas
>
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/102779/">http://git.reviewboard.kde.org/r/102779/</a>
</td>
</tr>
</table>
<br />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">the check makes sense; \
still wish we knew *where* these odd tasks were coming from (my guess is that they \
are created and then deleted almost immediately somewhere, but not before the tasks \
widget is told about them ..)
in any case, it looks like there is a potential problem with the new'ing of the \
WindowTaskItem when the groupItem is invalid. if you could clear that up and then \
commit, that'd be awesome. thanks for tracking this down! i know how much time \
and effort you poured into this ... many will be thankful.</pre> <br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://git.reviewboard.kde.org/r/102779/diff/1/?file=37884#file37884line473" \
style="color: black; font-weight: bold; text-decoration: \
underline;">plasma/desktop/applets/tasks/taskgroupitem.cpp</a> <span \
style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
">AbstractTaskItem *TaskGroupItem::createAbstractItem(TaskManager::AbstractGroupableItem \
*groupableItem)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">473</font></th> <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">WindowTaskItem</span> <span class="o">*</span><span \
class="n">windowItem</span> <span class="o">=</span> <span class="k">new</span> <span \
class="n">WindowTaskItem</span><span class="p">(</span><span \
class="k">this</span><span class="p">,</span> <span class="n">m_applet</span><span \
class="p">);</span></pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">473</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="n">WindowTaskItem</span> \
<span class="o">*</span><span class="n">windowItem</span> <span class="o">=</span> \
<span class="k">new</span> <span class="n">WindowTaskItem</span><span \
class="p">(</span><span class="k">this</span><span class="p">,</span> <span \
class="n">m_applet</span><span class="p">);</span></pre></td> </tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">474</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n"><span \
class="hl">window</span>Item</span><span class="o"><span \
class="hl">-></span></span><span class="n"><span \
class="hl">setT</span>ask</span><span class="p"><span class="hl">(</span></span><span \
class="k">static_cast</span><span class="o"><</span><span \
class="n">TaskManager</span><span class="o">::</span><span \
class="n">TaskItem</span><span class="o">*></span><span class="p">(</span><span \
class="n">groupableItem</span><span class="p">)<span \
class="hl">)</span>;</span></pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px \
solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">474</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="n"><span \
class="hl">TaskManager</span></span><span class="o"><span \
class="hl">::</span></span><span class="n"><span \
class="hl">Task</span>Item</span><span class="hl"> </span><span class="o"><span \
class="hl">*</span></span><span class="hl"> </span><span class="n"><span \
class="hl">t</span>ask<span class="hl">Item</span></span><span class="hl"> \
</span><span class="o"><span class="hl">=</span></span><span class="hl"> </span><span \
class="k">static_cast</span><span class="o"><</span><span \
class="n">TaskManager</span><span class="o">::</span><span \
class="n">TaskItem</span><span class="o">*></span><span class="p">(</span><span \
class="n">groupableItem</span><span class="p">);</span></pre></td> </tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">475</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">if</span> <span class="p">(</span><span class="o">!</span><span \
class="n">taskItem</span><span class="o">-></span><span \
class="n">startup</span><span class="p">()</span> <span class="o">&&</span> \
<span class="o">!</span><span class="n">taskItem</span><span \
class="o">-></span><span class="n">task</span><span class="p">())</span> <span \
class="p">{</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">476</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="k">return</span> <span class="n">item</span><span \
class="p">;</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">477</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="p">}</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">478</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">windowItem</span><span class="o">-></span><span \
class="n">setTask</span><span class="p">(</span><span class="n">taskItem</span><span \
class="p">);</span></pre></td> </tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">475</font></th> <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">item</span> <span class="o">=</span> <span class="n">windowItem</span><span \
class="p">;</span></pre></td> <th bgcolor="#f0f0f0" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">479</font></th> <td bgcolor="#ffffff" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="n">item</span> <span \
class="o">=</span> <span class="n">windowItem</span><span \
class="p">;</span></pre></td> </tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">looks like \
a possible memory leak (well, not quite; it's still parented properly) due to the \
WindowTaskItem being new'd but not actually used.
it could be written sth like this instead:
} else {
TaskManager::TaskItem * taskItem = \
static_cast<TaskManager::TaskItem*>(groupableItem);
if (taskItem->startup() || taskItem->task()) {
WindowTaskItem *windowItem = new WindowTaskItem(this, m_applet);
windowItem->setTask(taskItem);
item = windowItem;
}
}
if (!item) {
return 0;
}</pre>
</div>
<br />
<p>- Aaron J.</p>
<br />
<p>On October 5th, 2011, 9:26 a.m., Alex Fiestas wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for Plasma and Aaron J. Seigo.</div>
<div>By Alex Fiestas.</div>
<p style="color: grey;"><i>Updated Oct. 5, 2011, 9:26 a.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Well, as some of you may know I have been tracking down the ghost \
entries bug... this time I have NOT been able to fix the source of the problem but at \
least after some GDB at BDS I think I have a workaround.
A Ghost entry happens when a TaskItem is not either a startup or a task, in that case \
the code that "paints" the task doesn't know what to do but it reserve \
the space anyway. Currently the code path is like this:
1-TaskGruopItem::itemAdded is called
2-It calles TaskGruopItem::createAbstractItem
3-createAbstractItem takes a GroupableItem and cast it either to a GroupItem, or \
LauncherItem or TaskItem depending on the ::itemTtype()
createAbstractItem is prepared to return 0 when an AbstractTaskItem can't be \
created, and even further WindowTaskItem::setTask is checking if the taskItem is not \
a startup or a task, the problem is that setTask returns void so we can't really \
know if the "setting" was succeed or not. In that case, an \
"empty" WindowTaskItem is returned, being it a ghost entry.
This workaround what does is check if the taskItem is valid, if it is not 0 is \
returned.
This is a workaround since, in theory a TaskItem should ALWAYS be either a startup or \
a task so we should find the root of the problem instead of adding yet another check. \
Is precisely this kind of checks that make all *tasks* stack a mess. </pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">I have been using the patch for 3 days playing around with activities \
and virtual desktops, so far so good.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>plasma/desktop/applets/tasks/taskgroupitem.cpp <span style="color: \
grey">(eec27c2)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/102779/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic