<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="https://git.reviewboard.kde.org/r/114895/">https://git.reviewboard.kde.org/r/114895/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On January 7th, 2014, 2:14 p.m. UTC, <b>Martin Gräßlin</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">checking obviously makes sense, though it shouldn't be needed. There must be something else which is wrong here, too.

Could you try what the value of WId is in these cases? I wouldn't be surprised if it were 0.

Oh and that code has unit tests, so I would appreciate if you extend the tests for that case.</pre>
 </blockquote>




 <p>On January 7th, 2014, 2:22 p.m. UTC, <b>David Edmundson</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">WId seems to be valid. If I check the dialog with xwininfo before closing plasmoidviewer it shows the same ID.

Here is a full backtrace of it being needed: http://pastebin.kde.org/pxjhgw95d

I can guard against it inside plasma with 
if (!QApplication::closingDown()) around the KWindowEffects calls.

I changed to guarding in the library as I can imagine others hitting it in the future and in general library code shouldn't crash on reasonable inputs.



</pre>
 </blockquote>





 <p>On January 7th, 2014, 2:48 p.m. UTC, <b>Martin Gräßlin</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <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 backtrace includes QWindow::destroy which as the name says will do an xcb_destroy_window. After that the DialogProxy::onVisibleChanged will be invoked. At that point the window doesn't exist any more so the X calls are just wrong. I'd say this needs fixing in DialogProxy to not call the X specific calls for a destroyed window.

Then one could think about whether invoking the methods without a valid xcb_connection is supposed to work. I'd say we should add asserts there instead of the null checks. What do you think?</pre>
 </blockquote>





 <p>On January 8th, 2014, 10:27 a.m. UTC, <b>Martin Gräßlin</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I just had a look at the QWindow implementation and whether it could provide us a useable way to figure out whether there is a window at all. Unfortunately it doesn't. So ShipIt!</pre>
 </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I had a try at making a unit test but couldn't reproduce the crash I was seeing in Plasma; deleting the m_widget and m_window before calling KWindowEffect::whatever didn't seem to be enough. </pre>
<br />










<p>- David</p>


<br />
<p>On January 7th, 2014, 1:57 p.m. UTC, David Edmundson wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for KDE Frameworks, Martin Gräßlin and Marco Martin.</div>
<div>By David Edmundson.</div>


<p style="color: grey;"><i>Updated Jan. 7, 2014, 1:57 p.m.</i></p>









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


<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;">Guard against null QX11Info::connection()

This can fail if the application is currently shutting down,
this is currently causing a crash on closing plasma with dialogs
open.


</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;">Opened plasmoidviewer -a org.kde.example.widgetgallery expanded the applet, then closed plasmoidviewer
It used to crash, now it doesn't.</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>src/kwindoweffects_x11.cpp <span style="color: grey">(72cbb71)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/114895/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>