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



<table bgcolor="#e0e0e0" width="100%" cellpadding="8" style="border: 1px gray solid;">
 <tr>
  <td>
   <h1 style="margin-right: 0.2em; 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="8" style="background-image: url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Calligra and Pierre Stirnweiss.</div>
<div>By Elvis Stansvik.</div>


<p style="color: grey;"><i>Updated May 27, 2013, 2:15 p.m.</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;">During the loading of the attached document (from bug #319048 ), DockerStylesComboModel::styleApplied is called with the default paragraph style as argument.

The function assumes that the source model can provide an index for the supplied style (see the calls to indexForCharacterStyle). But the source model explicitly avoids adding items for the default styles, so these calls will return an invalid index, which results in a -1 being added as a row to m_usedStyles. In the next call to styleApplied, this will result in an invalid internalId being used to try to get the corresponding style from the style manager. The invalid style pointer is then used, resulting in the crash described in the bug.

The attached patch turns DockerStylesComboModel::styleApplied into a no-op if the supplied style is either the default character style or the default paragraph styles, since there will never be any items for these in the source model.

I'm not sure this is the correct fix, so would be great if e.g. Pierre could have a look.</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;">Tried to load the attached document before/after the fix. And the problem seems solved.</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=319048">319048</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>plugins/textshape/dialogs/DockerStylesComboModel.cpp <span style="color: grey">(40ae007)</span></li>

</ul>

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



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">File Attachments </h1>

<ul>

 <li><a href="http://git.reviewboard.kde.org/media/uploaded/files/2013/05/18/space.odt">The ODT provoking the crash</a></li>

</ul>





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




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