<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/121360/">https://git.reviewboard.kde.org/r/121360/</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 5th, 2015, 4:19 p.m. CET, <b>David Edmundson</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="https://git.reviewboard.kde.org/r/121360/diff/2/?file=337844#file337844line111" style="color: black; font-weight: bold; text-decoration: underline;">applets/notifications/plugin/notificationshelper.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 2)

    </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 NotificationsHelper::addNotificationPopup(QObject *win)</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">110</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="n">sender</span><span class="p">()</span> <span class="o">!=</span> <span class="n">nullptr</span> <span class="o">&&</span> <span class="n">sender</span><span class="p">()</span><span class="o">-></span><span class="n">inherits</span><span class="p">(</span><span class="s">"QTimer"</span><span class="p">))</span> <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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">you're liable to break here.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">sometimes you call this directly not via the Qt meta system. (i.e processHide)</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">what calls processHide? could be the user pressing close, could be a timeout. If so the sender() will be that timer. It's the sender of the last signal we're processing, not the last method call made.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I suggest maybe </p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%">connect(m_dispatchTimer, <span style="color: #666666">&</span>QTimer<span style="color: #666666">::</span>timeout, this, [this]{m_busy<span style="color: #666666">=</span><span style="color: #008000">false</span> ; processQueues()}
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">instead</p></pre>
 </blockquote>



 <p>On January 5th, 2015, 4:30 p.m. CET, <b>Martin Klapetek</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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">processHide is called just and only from processQueues. Basically processQueues works as sort of dispatcher and processHide just returns the control back to it, it will then simply process next item in the queue. It's perfectly safe as processQueues is ever only called either manually (sender() == 0) or by the timer (sender() == QTimer). The lambda slot is maybe nicer, I just thought that it makes the code a bit harder to read...but I don't care that much.</p></pre>
 </blockquote>





 <p>On January 5th, 2015, 4:40 p.m. CET, <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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">calling it manually does not set the sender to 0.</p></pre>
 </blockquote>





 <p>On January 5th, 2015, 4:44 p.m. CET, <b>Martin Klapetek</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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Yes it does.</p></pre>
 </blockquote>





 <p>On January 5th, 2015, 4:47 p.m. CET, <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;"><blockquote style="text-rendering: inherit;padding: 0 0 0 1em;border-left: 1px solid #bbb;white-space: normal;margin: 0 0 0 0.5em;line-height: inherit;">
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0.</p>
</blockquote></pre>
 </blockquote>





 <p>On January 5th, 2015, 4:53 p.m. CET, <b>Martin Klapetek</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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">For the record, I've changed it to use the lambda slot and removed this code in question, however reviewboard is rejecting the updated diff with "The file "dataengines/notifications/notificationsengine.cpp" (revision 2df6612) was not found in the repository". So I'll try later.</p></pre>
 </blockquote>





 <p>On January 5th, 2015, 9:49 p.m. CET, <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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">@Martin G</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">That's referring to when it's called with QMetaObject::invoke(). If you skip calling it directly and not via the meta object system it'll be the sender of the last slot that was called as a slot in the stack on this thread. </p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Given the code has been changed anyway, it would be rather petty and childish to write a small test app just to smugly gloat that I am right.
Naturally, that's exactly what I've done: http://static.davidedmundson.co.uk/testqobject.zip</p></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;"><blockquote style="text-rendering: inherit;padding: 0 0 0 1em;border-left: 1px solid #bbb;white-space: normal;margin: 0 0 0 0.5em;line-height: inherit;">
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">That's referring to when it's called with QMetaObject::invoke().</p>
</blockquote>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">given the documentation: that is unexpected. Thanks for correcting me and I suggest to go for an update to Qt docs.</p></pre>
<br />




<p>- Martin</p>


<br />
<p>On January 6th, 2015, 2:32 p.m. CET, Martin Klapetek wrote:</p>









<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
 <tr>
  <td>

<div>Review request for Plasma and Kai Uwe Broulik.</div>
<div>By Martin Klapetek.</div>


<p style="color: grey;"><i>Updated Jan. 6, 2015, 2:32 p.m.</i></p>







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


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


</div>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
plasma-workspace
</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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">There can easily be situations where the popups could overlap one another or result in strange animations. This patch rewrites the notifications so that all actions such as show/reposition/hide are handled from a one single place and every action is properly queued and protected around, which makes it more robust, more predictive and less chaotic. There's also a slight delay between every action so it's also visually much more cleaner and easier to see what's going on. </p></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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Tested whole day plus stress-tested with something like for i in {1..200}; do notify-send "$i - $RANDOM" "$RANDOM sdf sdf sdfwefhsdjfnskdfbkwefnos igodsfgn sodifgj asodfgnsdlfgdf g"; done executed from 4 terminals at once, all works fine and as expected.</p></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>applets/notifications/plugin/notificationshelper.h <span style="color: grey">(af8f6fa)</span></li>

 <li>applets/notifications/plugin/notificationshelper.cpp <span style="color: grey">(425f0d6)</span></li>

 <li>dataengines/notifications/notificationsengine.cpp <span style="color: grey">(d4b7f19)</span></li>

 <li>applets/notifications/package/contents/ui/NotificationPopup.qml <span style="color: grey">(8eb1912)</span></li>

</ul>

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






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








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