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

List:       kde-panel-devel
Subject:    Re: Review Request 123494: Create DesktopView before connecting signals from the activity consumer
From:       "David Edmundson" <david () davidedmundson ! co ! uk>
Date:       2015-04-25 10:52:20
Message-ID: 20150425105220.5446.17763 () mimi ! kde ! org
[Download RAW message or body]

--===============4073441005887877977==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit



> On April 25, 2015, 10:27 a.m., David Edmundson wrote:
> > Ship it * 1000
> 
> David Edmundson wrote:
> Wait. How can this make any difference?
> 
> DBus slots all happen in the main thread's event loop, which means we must have \
> finished all this function before that. 
> The only way this could change the behaviour is if something in new DesktopView() \
> is calling creating a new event loop or calling qApp->processEvents() 
> do you still have the entire trace?

Well, I was right

ActivitiesSync::currentActivity

        while (activities->serviceStatus() == KActivities::Consumer::Unknown) {
            QCoreApplication::instance()->processEvents();
        }
        

Your QML code is creating an activities model which calls this rather questionable \
segment of code. It's possible Kicker is too.

You can push your change if you want a quick fix, it won't do any harm, but the real \
fix will be replacing this method. 

Blocking DBus calls should be made with the normal sensible blocking DBus API (or not \
done at all) not doing this processing all sorts of things out of whack.


- David


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/123494/#review79491
-----------------------------------------------------------


On April 25, 2015, 3:56 a.m., Bhushan Shah wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/123494/
> -----------------------------------------------------------
> 
> (Updated April 25, 2015, 3:56 a.m.)
> 
> 
> Review request for Plasma and Marco Martin.
> 
> 
> Repository: plasma-workspace
> 
> 
> Description
> -------
> 
> This avoids the crash situation where something have created the activity consumer \
> earlier and currentActivityChanged signal is emitted before view is created. 
> ```
> #0  PlasmaQuick::View::setContainment (this=0x0, cont=0x16a9fc0) at \
> /home/bshah/aur/plasma-framework-git/src/plasma-framework/src/plasmaquick/view.cpp:243
>  #1  0x0000000000462097 in StandaloneAppCorona::currentActivityChanged \
> (this=0x7772a0, newActivity=...) at \
> /home/bshah/aur/plasma-workspace-git/src/plasma-workspace/shell/standaloneappcorona.cpp:192
>  #2  0x00007ffff32383c9 in QMetaObject::activate(QObject*, int, int, void**) () \
> from /usr/lib/libQt5Core.so.5 #3  0x00007ffff71f9763 in \
> KActivities::Consumer::currentActivityChanged (this=0x741aa0, _t1=...) at \
> /home/bshah/aur/kactivities-git/src/build/src/lib/core/moc_consumer.cpp:216 #4  \
> 0x00007ffff71f94dd in KActivities::Consumer::qt_static_metacall (_o=0x741aa0, \
> _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffffffa570) at \
> /home/bshah/aur/kactivities-git/src/build/src/lib/core/moc_consumer.cpp:103 #5  \
> 0x00007ffff32383c9 in QMetaObject::activate(QObject*, int, int, void**) () from \
> /usr/lib/libQt5Core.so.5 #6  0x00007ffff71f91d6 in \
> KActivities::ActivitiesCache::currentActivityChanged (this=0x77c900, _t1=...) at \
> /home/bshah/aur/kactivities-git/src/build/src/lib/core/moc_activitiescache_p.cpp:353
>  #7  0x00007ffff71ee4f7 in KActivities::ActivitiesCache::setCurrentActivity \
> (this=0x77c900, activity=...) at \
> /home/bshah/aur/kactivities-git/src/kactivities/src/lib/core/activitiescache_p.cpp:297
>  ```
> 
> I hit this crash when creating recent media backend for pmc. First backendsmodel is \
> initalized which in turn loads the recentmedia backend and hence creates the \
> activity consumer first. Afterwards when signal is connected it calls \
> currentActivityChanged slot and fails to set containment on null view. 
> 
> Diffs
> -----
> 
> shell/standaloneappcorona.cpp efa5c91 
> 
> Diff: https://git.reviewboard.kde.org/r/123494/diff/
> 
> 
> Testing
> -------
> 
> works fine
> 
> 
> Thanks,
> 
> Bhushan Shah
> 
> 


--===============4073441005887877977==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit




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





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On April 25th, 2015, 10:27 a.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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Ship it * 1000</p></pre>  </blockquote>




 <p>On April 25th, 2015, 10:32 a.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;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Wait. \
How can this make any difference?</p> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">DBus slots all happen \
in the main thread's event loop, which means we must have finished all this function \
before that.</p> <p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">The only way this could change the behaviour is if \
something in new DesktopView() is calling creating a new event loop or calling \
qApp-&gt;processEvents()</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">do you still have the entire \
trace?</p></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;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Well, \
I was right</p> <p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">ActivitiesSync::currentActivity</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%">    \
<span style="color: #008000; font-weight: bold">while</span> <span style="color: \
#666666">(</span><span style="color: #008000; font-weight: \
bold">activities-</span><span style="color: #666666">&gt;</span><span style="color: \
#008000; font-weight: bold">serviceStatus</span><span style="color: \
#666666">()</span> <span style="color: #666666">==</span> <span style="color: \
#008000; font-weight: bold">KActivities</span><span style="color: \
#666666">:</span><span style="color: #AA22FF">:Consumer</span><span style="color: \
#666666">:</span><span style="color: #AA22FF">:Unknown</span><span style="color: \
                #666666">)</span> {
        QCoreApplication<span style="color: #666666">::</span>instance()<span \
style="color: #666666">-&gt;</span>processEvents();  }
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Your QML code is creating an activities model which \
calls this rather questionable segment of code. It's possible Kicker is too.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">You can push your change if you want a quick fix, it \
won't do any harm, but the real fix will be replacing this method. </p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">Blocking DBus calls should be made with the normal sensible blocking DBus \
API (or not done at all) not doing this processing all sorts of things out of \
whack.</p></pre> <br />










<p>- David</p>


<br />
<p>On April 25th, 2015, 3:56 a.m. UTC, Bhushan Shah 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 Marco Martin.</div>
<div>By Bhushan Shah.</div>


<p style="color: grey;"><i>Updated April 25, 2015, 3:56 a.m.</i></p>









<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;">This avoids the crash situation where something have \
created the activity consumer earlier and currentActivityChanged signal is emitted \
before view is created.</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%">#0  \
PlasmaQuick::View::setContainment (this=0x0, cont=0x16a9fc0) at \
/home/bshah/aur/plasma-framework-git/src/plasma-framework/src/plasmaquick/view.cpp:243
 #1  0x0000000000462097 in StandaloneAppCorona::currentActivityChanged \
(this=0x7772a0, newActivity=...)  at \
/home/bshah/aur/plasma-workspace-git/src/plasma-workspace/shell/standaloneappcorona.cpp:192
 #2  0x00007ffff32383c9 in QMetaObject::activate(QObject*, int, int, void**) () from \
/usr/lib/libQt5Core.so.5 #3  0x00007ffff71f9763 in \
KActivities::Consumer::currentActivityChanged (this=0x741aa0, _t1=...) at \
/home/bshah/aur/kactivities-git/src/build/src/lib/core/moc_consumer.cpp:216 #4  \
0x00007ffff71f94dd in KActivities::Consumer::qt_static_metacall (_o=0x741aa0, \
_c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffffffa570)  at \
/home/bshah/aur/kactivities-git/src/build/src/lib/core/moc_consumer.cpp:103 #5  \
0x00007ffff32383c9 in QMetaObject::activate(QObject*, int, int, void**) () from \
/usr/lib/libQt5Core.so.5 #6  0x00007ffff71f91d6 in \
KActivities::ActivitiesCache::currentActivityChanged (this=0x77c900, _t1=...) at \
/home/bshah/aur/kactivities-git/src/build/src/lib/core/moc_activitiescache_p.cpp:353 \
#7  0x00007ffff71ee4f7 in KActivities::ActivitiesCache::setCurrentActivity \
(this=0x77c900, activity=...)  at \
/home/bshah/aur/kactivities-git/src/kactivities/src/lib/core/activitiescache_p.cpp:297
 </pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">I hit this crash when creating recent media backend \
for pmc. First backendsmodel is initalized which in turn loads the recentmedia \
backend and hence creates the activity consumer first. Afterwards when signal is \
connected it calls currentActivityChanged slot and fails to set containment on null \
view.</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;">works fine</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>shell/standaloneappcorona.cpp <span style="color: grey">(efa5c91)</span></li>

</ul>

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






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







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


--===============4073441005887877977==--


[Attachment #3 (text/plain)]

_______________________________________________
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