[prev in list] [next in list] [prev in thread] [next in thread]
List: kwin
Subject: Re: Review Request: Protect animation list iterators against external changes
From: Martin_Gräßlin <kde () martin-graesslin ! com>
Date: 2013-01-04 7:55:19
Message-ID: 20130104075519.25925.37006 () 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/108151/#review24637
-----------------------------------------------------------
Ship it!
Fine for me and I don't think we have to worry about the performance of the \
re-evaluation of the iterators. It's not like this is in the hot code path.
kwin/libkwineffects/kwinanimationeffect.cpp
<http://git.reviewboard.kde.org/r/108151/#comment18907>
comment does not sound like valid English :-)
- Martin Gräßlin
On Jan. 3, 2013, 11:15 p.m., Thomas Lübking wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/108151/
> -----------------------------------------------------------
>
> (Updated Jan. 3, 2013, 11:15 p.m.)
>
>
> Review request for kwin and Martin Gräßlin.
>
>
> Description
> -------
>
> I recently started to run into random crashes on the heap and slightly started to \
> fear to have broken sth. on activities... whatever.
> Turned out* that moving BE::Faded to AnimationEffect and for the very first time \
> actually using "animationEnded" to chain animations (fade out -> fade in) would \
> (actually obviously) alter the m_animations list what unfortunately turns our nice \
> little iterators into random junk.
> So this patch tracks list manipulations (in this case during the iteration calling \
> animationEnded, being the natural candidate) and when they happen, re-validates the \
> iterators (the map traversion is required due to the internals of QMap/QHash; the \
> list could instead also be accessed by entry->first.at(animationCounter) instead; \
> not sure about performance impact but it would have made the patch much larger ;-)
> * I actually figured it because resizing on fullscreen changes always worked like \
> crap because the window gets to resizes in a row (once for the decoration being \
> removed and then the actual resize to the FS geometry) what got me multiplicative \
> traslation/scaling. Chaining this made the crashes pretty reproducible but the \
> result is pretty cool =)
>
> Diffs
> -----
>
> kwin/libkwineffects/kwinanimationeffect.cpp e0a6694
>
> Diff: http://git.reviewboard.kde.org/r/108151/diff/
>
>
> Testing
> -------
>
> hehe - i un/fullscreened mplayer about a hundred times the last few minutes.
> That crashed nearly *each* time before the patch.
>
>
> Thanks,
>
> Thomas Lübking
>
>
[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/108151/">http://git.reviewboard.kde.org/r/108151/</a>
</td>
</tr>
</table>
<br />
<p>Ship it!</p>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Fine for me and I \
don't think we have to worry about the performance of the re-evaluation of the \
iterators. It's not like this is in the hot code path.</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/108151/diff/1/?file=104419#file104419line242" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kwin/libkwineffects/kwinanimationeffect.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; ">void \
AnimationEffect::prePaintScreen( ScreenPrePaintData& data, int time )</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">242</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="n">Q_ASSERT</span><span class="p">(</span><span class="n">entry</span> \
<span class="o">!=</span> <span class="n">mapEnd</span><span class="p">);</span> \
<span class="c1">// the user should for not delete animations from \
animationEnded</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;">comment \
does not sound like valid English :-)</pre> </div>
<br />
<p>- Martin</p>
<br />
<p>On January 3rd, 2013, 11:15 p.m., Thomas Lübking 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 kwin and Martin Gräßlin.</div>
<div>By Thomas Lübking.</div>
<p style="color: grey;"><i>Updated Jan. 3, 2013, 11:15 p.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;">I recently started to run into random crashes on the heap and slightly \
started to fear to have broken sth. on activities... whatever.
Turned out* that moving BE::Faded to AnimationEffect and for the very first time \
actually using "animationEnded" to chain animations (fade out -> fade \
in) would (actually obviously) alter the m_animations list what unfortunately turns \
our nice little iterators into random junk.
So this patch tracks list manipulations (in this case during the iteration calling \
animationEnded, being the natural candidate) and when they happen, re-validates the \
iterators (the map traversion is required due to the internals of QMap/QHash; the \
list could instead also be accessed by entry->first.at(animationCounter) instead; \
not sure about performance impact but it would have made the patch much larger ;-)
* I actually figured it because resizing on fullscreen changes always worked like \
crap because the window gets to resizes in a row (once for the decoration being \
removed and then the actual resize to the FS geometry) what got me multiplicative \
traslation/scaling. Chaining this made the crashes pretty reproducible but the result \
is pretty cool =)</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;">hehe - i un/fullscreened mplayer about a hundred times the last few \
minutes. That crashed nearly *each* time before the patch.</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>kwin/libkwineffects/kwinanimationeffect.cpp <span style="color: \
grey">(e0a6694)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/108151/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic