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





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On October 23rd, 2010, 9:12 a.m., <b>Mark Kretschmann</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;">Even though QWeakPointer is sometimes not needed, I&#39;m for using it liberally anyway. That&#39;s because:

1) There is virtually no overhead (Thiago designed the class very well).
2) Better to be safe than sorry.
3) It&#39;s good programming practice. We have many contributors, and not everyone is an expert on memory management.
</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;">I was going to disagree, reasoning that there are almost 100 instances of m_collection in SqlMeta.
But then I noticed that you need them mostly for writing the information to the database.

Also there is one problem. You will need to protect the collection from being deleted while data is written. 
That is currently not done.
Also checks for if(m_collection) were not done in all places.

I just checked the code and the CollectionManager does rely on having an sql database always but it&#39;s not protecting it in any special was, so in principle it could be deleted.


A counter proposal: How about a shared pointer for Collections.
After all if e.g. the dynamic playlist is currently calculating a new playlist in another thread you can&#39;t just delete it&#39;s collection.
</pre>
<br />








<p>- Ralf</p>


<br />
<p>On October 23rd, 2010, 12:19 a.m., Ralf Engels wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.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 Amarok.</div>
<div>By Ralf Engels.</div>


<p style="color: grey;"><i>Updated 2010-10-23 00:19:36</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; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This patch improves the SqlMeta thread safety.
It has several parts:
- Use QReadWriteLock for SqlTrack.
 For this I also needed to pull the read accessor functions into the .cpp
- SqlCollection is a const pointer.
 All metas are directly dependent on the SqlCollection and it could and should never change.
 Using weak pointers here is not needed.
 Note that now the access to m_collection is also thread safe as it&#39;s const
- SqlAlbum::setCompilation did modify the old album
 This was changed an a new album will be created.
 The positive side effect is that the UI will now update directly if setting a compilation
- SqlAlbum::setImage will now copy embedded images directly when set
 If the track-uid is set (maybe from another thread) the cover image will still be found.
 Note that the image cache is and was not connected to the track uid.</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;">setting and unsetting compilation
changing album name
scanning and fully scanning collection</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=254631">254631</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>src/core-impl/collections/sqlcollection/CapabilityDelegateImpl.cpp <span style="color: grey">(78fd02b)</span></li>

 <li>src/core-impl/collections/sqlcollection/SqlCollection.cpp <span style="color: grey">(b88d257)</span></li>

 <li>src/core-impl/collections/sqlcollection/SqlMeta.h <span style="color: grey">(b92e351)</span></li>

 <li>src/core-impl/collections/sqlcollection/SqlMeta.cpp <span style="color: grey">(6b29b6e)</span></li>

 <li>src/core-impl/collections/sqlcollection/SqlRegistry.h <span style="color: grey">(66ba632)</span></li>

 <li>src/core-impl/collections/sqlcollection/SqlRegistry.cpp <span style="color: grey">(e1b3571)</span></li>

 <li>tests/core-impl/collections/sqlcollection/TestSqlArtist.cpp <span style="color: grey">(d57f55a)</span></li>

</ul>

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




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








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