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

List:       kde-core-devel
Subject:    Re: Review Request: Make sure to remove KXMLGUIClients from factory on
From:       "David Faure" <faure () kde ! org>
Date:       2010-07-03 22:44:07
Message-ID: 20100703224407.7749.57114 () localhost
[Download RAW message or body]

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

Ship it!


I was initially against this kind of thing (too many problems with "intelligent" \
destructors), this is why it hasn't been done before. But after long consideration, I \
think this one is safe and, as you say, somewhat expected by users of the framework, \
so I'm ok with it. I'll commit it to trunk, at least, we'll see if it proves stable \
enough for 4.5.0. Thanks a lot for the patch, and sorry for the delay.

- David


On 2010-06-01 07:15:25, Thomas Friedrichsmeier wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/4126/
> -----------------------------------------------------------
> 
> (Updated 2010-06-01 07:15:25)
> 
> 
> Review request for kdelibs, Christoph Feck and David Faure.
> 
> 
> Summary
> -------
> 
> Under some circumstances, dangling pointers to deleted KXMLGUIClients may remain in \
> the list of a KXMLGUIFactory's clients. Usually, KXMLGUIClients are also KParts, \
> and managed by a KPartManager. If everything goes as expected, the KPartManager \
> detects when the active KPart is destroyed, and the KParts::MainWindow takes care \
> of removing it from the factory. When XMLGUIClients are nested, things may not \
> always go as smoothly. KXMLGUIFactory::removeClient() removes clients recursively, \
> however, if one of the child clients gets destroyed before the parent KParts was \
> removed from the factory, it will be taken out of the parent client's list of \
> children, but not out of the factory's list of clients. Possibly, there are other \
> subtle cases, where dangling pointer remain in KXMLGUIFactory::clients(). Naturally \
> this will lead to crashes, when code tries to do something with all clients of the \
> factory. The listed bugs are symptoms of this cause (at least potentially; with \
> non-reproducible bugs it's always hard to tell, whether there was only a single \
> cause). 
> Probably this issue is addressable in the respectively parts / applications, by \
> making sure that any child clients are not deleted before the toplevel part is \
> removed from the factory. However, it is possible, and sensible to add code in the \
> KXMLGUIClient d'tor to make sure that the factory will never keep dangling \
> pointers. This patch does so. Some additional code is needed to make sure that this \
> does not cause trouble during application exit, by making sure that the \
> KXMLGUIFactory is deleted before the KXMLGUIBuilder, and remaining clients no \
> longer assume a factory. 
> Note:
> Bug #170806 contains a valgrind log, and reproducible instructions on crashing \
> kontact, which can probably be mapped to other affected applications. 
> 
> This addresses bugs 170806, 183338, 205625, and 212397.
> https://bugs.kde.org/show_bug.cgi?id=170806
> https://bugs.kde.org/show_bug.cgi?id=183338
> https://bugs.kde.org/show_bug.cgi?id=205625
> https://bugs.kde.org/show_bug.cgi?id=212397
> 
> 
> Diffs
> -----
> 
> trunk/KDE/kdelibs/kdeui/tests/kxmlgui_unittest.h 1129152 
> trunk/KDE/kdelibs/kdeui/tests/kxmlgui_unittest.cpp 1129152 
> trunk/KDE/kdelibs/kdeui/xmlgui/kxmlguiclient.cpp 1129152 
> trunk/KDE/kdelibs/kdeui/xmlgui/kxmlguifactory.cpp 1129152 
> trunk/KDE/kdelibs/kdeui/xmlgui/kxmlguiwindow.cpp 1129152 
> 
> Diff: http://reviewboard.kde.org/r/4126/diff
> 
> 
> Testing
> -------
> 
> Fixes crashes during toolbar / shortcut configuration for RKWard.
> 
> Results of existing unit tests are not affected. New unit test added.
> 
> Tested on trunk, only. If this should go into 4.4, I'd like someone else to do the \
> commit on the branch. 
> 
> Thanks,
> 
> Thomas
> 
> 


[Attachment #3 (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://reviewboard.kde.org/r/4126/">http://reviewboard.kde.org/r/4126/</a>
  </td>
    </tr>
   </table>
   <br />



 <p>Ship it!</p>



 <pre>I was initially against this kind of thing (too many problems with \
&quot;intelligent&quot; destructors), this is why it hasn&#39;t been done before. But \
after long consideration, I think this one is safe and, as you say, somewhat expected \
by users of the framework, so I&#39;m ok with it. I&#39;ll commit it to trunk, at \
least, we&#39;ll see if it proves stable enough for 4.5.0. Thanks a lot for the \
patch, and sorry for the delay.</pre>  <br />







<p>- David</p>


<br />
<p>On June 1st, 2010, 7:15 a.m., Thomas Friedrichsmeier wrote:</p>




<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://reviewboard.kde.orgrb/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 kdelibs, Christoph Feck and David Faure.</div>
<div>By Thomas Friedrichsmeier.</div>


<p style="color: grey;"><i>Updated 2010-06-01 07:15:25</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;">Under some circumstances, dangling pointers to \
deleted KXMLGUIClients may remain in the list of a KXMLGUIFactory&#39;s clients. \
Usually, KXMLGUIClients are also KParts, and managed by a KPartManager. If everything \
goes as expected, the KPartManager detects when the active KPart is destroyed, and \
the KParts::MainWindow takes care of removing it from the factory. When XMLGUIClients \
are nested, things may not always go as smoothly. KXMLGUIFactory::removeClient() \
removes clients recursively, however, if one of the child clients gets destroyed \
before the parent KParts was removed from the factory, it will be taken out of the \
parent client&#39;s list of children, but not out of the factory&#39;s list of \
clients. Possibly, there are other subtle cases, where dangling pointer remain in \
KXMLGUIFactory::clients(). Naturally this will lead to crashes, when code tries to do \
something with all clients of the factory. The listed bugs are symptoms of this cause \
(at least potentially; with non-reproducible bugs it&#39;s always hard to tell, \
whether there was only a single cause).

Probably this issue is addressable in the respectively parts / applications, by \
making sure that any child clients are not deleted before the toplevel part is \
removed from the factory. However, it is possible, and sensible to add code in the \
KXMLGUIClient d&#39;tor to make sure that the factory will never keep dangling \
pointers. This patch does so. Some additional code is needed to make sure that this \
does not cause trouble during application exit, by making sure that the \
KXMLGUIFactory is deleted before the KXMLGUIBuilder, and remaining clients no longer \
assume a factory.

Note:
Bug #170806 contains a valgrind log, and reproducible instructions on crashing \
kontact, which can probably be mapped to other affected applications.</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;">Fixes crashes during toolbar / shortcut \
configuration for RKWard.

Results of existing unit tests are not affected. New unit test added.

Tested on trunk, only. If this should go into 4.4, I&#39;d like someone else to do \
the commit on the branch.</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="https://bugs.kde.org/show_bug.cgi?id=170806">170806</a>, 

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

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

 <a href="https://bugs.kde.org/show_bug.cgi?id=212397">212397</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>trunk/KDE/kdelibs/kdeui/tests/kxmlgui_unittest.h <span style="color: \
grey">(1129152)</span></li>

 <li>trunk/KDE/kdelibs/kdeui/tests/kxmlgui_unittest.cpp <span style="color: \
grey">(1129152)</span></li>

 <li>trunk/KDE/kdelibs/kdeui/xmlgui/kxmlguiclient.cpp <span style="color: \
grey">(1129152)</span></li>

 <li>trunk/KDE/kdelibs/kdeui/xmlgui/kxmlguifactory.cpp <span style="color: \
grey">(1129152)</span></li>

 <li>trunk/KDE/kdelibs/kdeui/xmlgui/kxmlguiwindow.cpp <span style="color: \
grey">(1129152)</span></li>

</ul>

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




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








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



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

Configure | About | News | Add a list | Sponsored by KoreLogic