[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwin
Subject:    Re: Review Request: don't emit windowClosed() on_shutdown
From:       Thomas_Lübking <thomas.luebking () web ! de>
Date:       2012-07-23 20:03:00
Message-ID: 20120723200300.2328.2205 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On July 23, 2012, 6:43 p.m., Martin Gräßlin wrote:
> > kwin/client.cpp, lines 239-243
> > <http://git.reviewboard.kde.org/r/105697/diff/1/?file=74612#file74612line239>
> > 
> > could it be that the moc has problems with the nullptr when the window closes? My \
> > understanding is that you are allowed to use null, but who knows what's going \
> > wrong there... 
> > somehow I would prefer to have this properly tested and confirmed that this \
> > problem also affects latest Qt version.

No, NULL is just the random deref. of a pointer parameter - as such it should be as \
good as any other memory

Most important is that the signal should no longer be connected to any slot here (as \
scene & effects are deleted)

The S&S system should look up a hashtable for the signal signature, figure the result \
is empty and return as there's nothing to do but one of the crashtraces ends in \
QMetaObject::activate (sender=0x1bf1270, m=<optimized out>, \
local_signal_index=<optimized out>, argv=0x7fff8b920fc0) at kernel/qobject.cpp:3484 \
what means that Qt believes there's sth. to activate, ie. the receiver did not unhook \
when it was deleted(?)

Could be an -03 issue *shrugs again*


- Thomas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/105697/#review16272
-----------------------------------------------------------


On July 23, 2012, 4:27 p.m., Thomas Lübking wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/105697/
> -----------------------------------------------------------
> 
> (Updated July 23, 2012, 4:27 p.m.)
> 
> 
> Review request for kwin and Martin Gräßlin.
> 
> 
> Description
> -------
> 
> I don't like this patch as solution, but is should be save and avoid the crash.
> If not, there's sth. deeper broken on the stack.
> 
> Workspace() as very first action calls finishCompositing(); what calls \
> scene->windowClosed(c, NULL); for all windows and then deletes effects and the \
> scene. 
> Next step is to unrelease all windows what emits windowClosed(this, del);
> 
> This is where the code crashes, but should not, because the signal is only bound by \
> effects and scene - which should at this point no longer exist. 
> 
> This addresses bug 303244.
> http://bugs.kde.org/show_bug.cgi?id=303244
> 
> 
> Diffs
> -----
> 
> kwin/client.cpp 09b0328 
> kwin/unmanaged.cpp e79004e 
> 
> Diff: http://git.reviewboard.kde.org/r/105697/diff/
> 
> 
> Testing
> -------
> 
> Applied patch and logged out - but i got no crashes before either.
> And emitting a signal should be safe anyway and all the time. *shrug*
> 
> 
> 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/105697/">http://git.reviewboard.kde.org/r/105697/</a>
  </td>
    </tr>
   </table>
   <br />








<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On July 23rd, 2012, 6:43 p.m., <b>Martin \
Gräßlin</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  



<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/105697/diff/1/?file=74612#file74612line239" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kwin/client.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 \
Client::releaseWindow(bool on_shutdown)</pre></td>

  </tr>
 </tbody>






 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">239</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">Deleted</span><span class="o">*</span> <span class="n">del</span> <span \
class="o">=</span> <span class="nb">NULL</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">239</font></th>  <td bgcolor="#ffffff" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">Deleted</span><span class="o">*</span> <span class="n">del</span> <span \
class="o">=</span> <span class="nb">NULL</span><span class="p">;</span></pre></td>  \
</tr>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">240</font></th>  <td bgcolor="#ffffff" 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">on_shutdown</span><span class="p">)</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">240</font></th>  <td bgcolor="#ffffff" 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">on_shutdown</span><span \
class="p">)</span> <span class="p">{</span></pre></td>  </tr>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">241</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="n">del</span> <span class="o">=</span> <span class="n">Deleted</span><span \
class="o">::</span><span class="n">create</span><span class="p">(</span><span \
class="k">this</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">241</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="n">del</span> <span class="o">=</span> <span class="n">Deleted</span><span \
class="o">::</span><span class="n">create</span><span class="p">(</span><span \
class="k">this</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">242</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="n">emit</span> <span class="n">windowClosed</span><span \
class="p">(</span><span class="k">this</span><span class="p">,</span> <span \
class="n">del</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">242</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">    <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">243</font></th>  <td bgcolor="#ffffff" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; ">    <span class="p">}</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">could it be that the moc \
has problems with the nullptr when the window closes? My understanding is that you \
are allowed to use null, but who knows what&#39;s going wrong there...

somehow I would prefer to have this properly tested and confirmed that this problem \
also affects latest Qt version.</pre>  </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">No, NULL is \
just the random deref. of a pointer parameter - as such it should be as good as any \
other memory

Most important is that the signal should no longer be connected to any slot here (as \
scene &amp; effects are deleted)

The S&amp;S system should look up a hashtable for the signal signature, figure the \
result is empty and return as there&#39;s nothing to do but one of the crashtraces \
ends in QMetaObject::activate (sender=0x1bf1270, m=&lt;optimized out&gt;, \
local_signal_index=&lt;optimized out&gt;, argv=0x7fff8b920fc0) at \
kernel/qobject.cpp:3484 what means that Qt believes there&#39;s sth. to activate, ie. \
the receiver did not unhook when it was deleted(?)

Could be an -03 issue *shrugs again*</pre>
<br />




<p>- Thomas</p>


<br />
<p>On July 23rd, 2012, 4:27 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 July 23, 2012, 4:27 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 don&#39;t like this patch as solution, but is should be save and avoid \
the crash. If not, there&#39;s sth. deeper broken on the stack.

Workspace() as very first action calls finishCompositing(); what calls \
scene-&gt;windowClosed(c, NULL); for all windows and then deletes effects and the \
scene.

Next step is to unrelease all windows what emits windowClosed(this, del);

This is where the code crashes, but should not, because the signal is only bound by \
effects and scene - which should at this point no longer exist.</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;">Applied patch and logged out - but i got no crashes before either. And \
emitting a signal should be safe anyway and all the time. *shrug*</pre>  </td>
 </tr>
</table>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="http://bugs.kde.org/show_bug.cgi?id=303244">303244</a>


</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>kwin/client.cpp <span style="color: grey">(09b0328)</span></li>

 <li>kwin/unmanaged.cpp <span style="color: grey">(e79004e)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/105697/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