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


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/media/rb/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 and David Faure.</div>
<div>By Ignat Semenov.</div>


<p style="color: grey;"><i>Updated Oct. 16, 2012, 2:43 p.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;">Fixed the 3 issues.</pre>
  </td>
 </tr>
</table>




<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;">Check the d pointer for validity since it is set to 0 by the defaut KFileItem ctor.

Patch based on similar code from QImage.

I'd like to draw your attention to these issues:

1) KFileItem::setUDSEntry()
For a null KFileItem, this should probably create a new d and initialize it. Ideally, we'd have a dedicated public function to do that (see QImage::create()), but since we can not change the public API (or can we?), I put the new in setUDSEntry(). Anyway, this is now the only interface function that can init a null KFileItem (before the patch, there had been none). All the other set* functions do not new the d, but rather return on d == 0.
2) KFileItem::cmp()
What should this return for a null KFileItem? I return false, but still, it feels wrong to me.
3) operator << / operator >>
<< returns "null KFileItem" for d == 0 and >> does nothing, returning the original stream unmodified. operator << thus duplicates the public operator <<(QDebug&).
4) This also overrides dfaure's patch for KFileItem::metaInfo(). There is a

return d->metaInfo()

at the end of the function, so this can crash as well.

All the classes' objects that are default-constructed and then returned in the case of d == 0 can be checked for validity, looked it up in the code.</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;">Builds fine.</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="http://bugs.kde.org/show_bug.cgi?id=299726">299726</a>


</div>


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

 <li>kio/kio/kfileitem.cpp <span style="color: grey">(8ab5a1d)</span></li>

</ul>

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




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




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