[prev in list] [next in list] [prev in thread] [next in thread] 

List:       calligra-devel
Subject:    Re: Review Request 110506: Ignore application of default styles in DockerStylesComboModel
From:       "Elvis Stansvik" <elvstone () gmail ! com>
Date:       2013-05-21 22:36:26
Message-ID: 20130521223626.4976.14522 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/110506/#review32944
-----------------------------------------------------------


Since Camilla reminded me that the styles models et.c. are being reworked (e.g. by \
Thorsten/Pierre?), I shouldn't invest too much time into them. But I think at least \
this crash fix would be nice in the interim. Perhaps it would be better to check for \
an invalid index instead of default styles. Inform me how you want the fix. Either \
way is OK with me :) (since the entire code might change soon anyway).

- Elvis Stansvik


On May 19, 2013, 9:44 a.m., Elvis Stansvik wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/110506/
> -----------------------------------------------------------
> 
> (Updated May 19, 2013, 9:44 a.m.)
> 
> 
> Review request for Calligra and Pierre Stirnweiss.
> 
> 
> Description
> -------
> 
> 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. 
> 
> This addresses bug 319048.
> http://bugs.kde.org/show_bug.cgi?id=319048
> 
> 
> Diffs
> -----
> 
> plugins/textshape/dialogs/DockerStylesComboModel.cpp 40ae007 
> 
> Diff: http://git.reviewboard.kde.org/r/110506/diff/
> 
> 
> Testing
> -------
> 
> Tried to load the attached document before/after the fix. And the problem seems \
> solved. 
> 
> File Attachments
> ----------------
> 
> The ODT provoking the crash
> http://git.reviewboard.kde.org/media/uploaded/files/2013/05/18/space.odt
> 
> 
> Thanks,
> 
> Elvis Stansvik
> 
> 


[Attachment #5 (text/html)]

<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 />





 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Since Camilla reminded \
me that the styles models et.c. are being reworked (e.g. by Thorsten/Pierre?), I \
shouldn&#39;t invest too much time into them. But I think at least this crash fix \
would be nice in the interim. Perhaps it would be better to check for an invalid \
index instead of default styles. Inform me how you want the fix. Either way is OK \
with me :) (since the entire code might change soon anyway).</pre>  <br />









<p>- Elvis</p>


<br />
<p>On May 19th, 2013, 9:44 a.m. UTC, Elvis Stansvik wrote:</p>








<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 19, 2013, 9:44 a.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&#39;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>



_______________________________________________
calligra-devel mailing list
calligra-devel@kde.org
https://mail.kde.org/mailman/listinfo/calligra-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic