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




<table bgcolor="#e0e0e0" width="100%" cellpadding="12" style="border: 1px gray solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
 <tr>
  <td>
   <h1 style="margin: 0; padding: 0; font-size: 10pt;">This change has been marked as submitted.</h1>
  </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 Marble.</div>
<div>By Calin Cruceru.</div>


<p style="color: grey;"><i>Updated Sept. 6, 2014, 6:56 a.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
marble
</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;">So I witnessed some time ago that the copy of GeoDataGeometry based classes did not work as expected and I figured out that the main cause were some missing detach() calls in functions returning either non-const references or pointer to some non-const member, which made possible their modification without creating a new *Private instance.</p>
<ul style="padding: 0;text-rendering: inherit;margin: 0 0 0 1em;line-height: inherit;white-space: normal;">
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">This patch adds those missing detach() calls on all GeoDataGeometry and GeoDataFeature based classes (shout me if we are using this technique in other classes so I can take a look there as well).</p>
</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">There is also one important change I thought of in GeoDataPlacemark. Before, in the copy constructor, we used to do p()->m_geometry->setParent( this ) which broke the invariant m_geometry->parent() == this for other. However, there was one more problem: when detach() was called for the first time, the newly created geometry (in GeoDataPlacemarkPrivate) did not have a parent set (it was zeroed) so after a GeoDataPlacemark copy was done, the other geometry's parent would point to the old placemark and the newly created (not immediately, but after the first detach() call) placemark wouldn't have its parent set at all. So, as a workaround, I added p()->m_geometry->setParent(this) after each detach() call in GeoDataPlacemark and removed the call from the copy constructor, so that the invariant is only broken for this, but only until the first detach() call and then each geometry correctly points to its parent.</p>
</li>
</ul>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">There is one thing I did not find a solution for and may be a problem: the folderList(), placemarkList() and featureList() methods in GeoDataContainare are marked as const but return QVector<GeoDataFeature*> so it may be possible to modify some GeoDataFeature objects through those pointers immediately after a copy of GeoDataContainer, without calling detach() - so it would affect members of the copied object.</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>tests/TestGeometryDetach.cpp <span style="color: grey">(PRE-CREATION)</span></li>

 <li>tests/TestFeatureDetach.cpp <span style="color: grey">(PRE-CREATION)</span></li>

 <li>tests/CMakeLists.txt <span style="color: grey">(47b2c68)</span></li>

 <li>src/plugins/render/annotate/AnnotatePlugin.cpp <span style="color: grey">(b1c8072)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataPolygon.cpp <span style="color: grey">(b8e0f32)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataPoint_p.h <span style="color: grey">(a7c19e0)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataPoint.cpp <span style="color: grey">(8c5d9c9)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataPoint.h <span style="color: grey">(401b25f)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataPlacemark.cpp <span style="color: grey">(b2d0304)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataMultiTrack.cpp <span style="color: grey">(9cc89bc)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataMultiGeometry_p.h <span style="color: grey">(df96074)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataMultiGeometry.cpp <span style="color: grey">(7c6d148)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataFeature.cpp <span style="color: grey">(9b354a2)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataGeometry.cpp <span style="color: grey">(8dfdd52)</span></li>

 <li>src/lib/marble/geodata/data/GeoDataContainer.cpp <span style="color: grey">(f0fae00)</span></li>

</ul>

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






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




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