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




<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 kde-workspace and Hugo Pereira Da Costa.</div>
<div>By Michael Pyne.</div>


<p style="color: grey;"><i>Updated May 22, 2016, 4:20 a.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</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;">Updates patch based on much of the feedback, with major reverts to the way I approached TileSets and QColor in particular. For the TileSets I went ahead and implemented what I was talking about regarding a simple FIFO-based cache that holds shared pointers. I used QSharedPointer<> for this since it doesn't require subclassing from QSharedData -- but if this is the only part of the code that uses TileSet it might make sense to subclass from QSharedData instead.

Although it builds, installs, makes it through oxygen-demo5 benchmark and all the rest, I'm not sure if the return value changes for TileSet are ABI-safe (do we track public API for this part of Oxygen? Does anything in a different library or application link to this?).

On the other hand, if we can change return value, we should also be able to do that for QColor which will significantly improve that portion of the code, as right now the code doesn't 'cache' QColor at all anymore, we just dump them into a QMap that stays alive throughout the process lifetime.

After reviewing the QCache sources I'm pretty sure this is all actually only a problem if you try to ::insert() into QCache with a cost > maxCost -- but we have codepaths in Oxygen that appear to lead to either reducing maxCost or disabling the cache entirely so I can understand why Coverity would be wary. But as long as we've convinced that we're not ever inserting entries into a cache with an invalid cost, I can also just flag those Coverity entries to be ignored if that would be easier, and then drop this RR.</pre>
  </td>
 </tr>
</table>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
oxygen
</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 should mostly complete the QCache fixes I kicked off in a previous RR, 127837. Hugo noted there were many other similar usages, and boy he wasn't kidding! ;) The long story short is that these usages can theoretically cause use-after-free behavior (which can lead to crashes and even undefined behavior if the compiler ever gets smart).</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">NOTE</em> It is -much- easier to review if you download the diff to your git repository for oxygen and then run "git diff -b" to ignore whitespace changes, particularly for the QPixmap changes.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">For QPixmaps we return values instead of pointers, so we simply make a separate copy to be cached when we do insert. For QColor we return references to values so we <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">must</em> return pointers, and those have to be owned by a QCache to avoid memleaks. So I added a helper function to loop until the cache accepts the new entry. TileSets are a similar concern, except those have manual loops since I was uncertain about whether TileSet's copy constructor was the best idea or not.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">This fixes a ton of Coverity issues (59717 - 259733, 259739, 259742 - 259752, 1336154, 1336155) and might be associated with Qt bug 38142 and KDE bug 219055 (which doesn't actually appear to be a dupe of a different bug to me...).</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;">Compiled without warnings, installed and ran <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">oxygen-demo5 -style oxygen</code>. Used the GUI Benchmark feature to automatically cycle through all the listed features -- no crashes or obvious rendering errors.</p></pre>
  </td>
 </tr>
</table>


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

 <li>kdecoration/oxygendecohelper.cpp <span style="color: grey">(aa75eca)</span></li>

 <li>kstyle/oxygenstyle.cpp <span style="color: grey">(e428606)</span></li>

 <li>kstyle/oxygenstylehelper.h <span style="color: grey">(9510a60)</span></li>

 <li>kstyle/oxygenstylehelper.cpp <span style="color: grey">(612ba37)</span></li>

 <li>liboxygen/oxygenhelper.h <span style="color: grey">(a6453a0)</span></li>

 <li>liboxygen/oxygenhelper.cpp <span style="color: grey">(4843604)</span></li>

 <li>liboxygen/oxygenshadowcache.cpp <span style="color: grey">(907e586)</span></li>

</ul>

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






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



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