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

List:       kwrite-devel
Subject:    Re: Review Request 113917: Fix assert in ~QPersistentModelIndex
From:       "Milian Wolff" <mail () milianw ! de>
Date:       2013-11-19 13:04:48
Message-ID: 20131119130448.24726.49338 () 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/113917/#review43938
-----------------------------------------------------------



part/completion/katecompletionmodel.cpp
<http://git.reviewboard.kde.org/r/113917/#comment31551>

    if this is called from within setCurrentCompletion, you'll nest the reset signals \
- is this supported by Qt?  
    i.e.:
    
    beginResetModel();
    changeCompletions() ->
    beginResetModel();
    endResetModel();
    --> setCurrentCompletion()
    endResetModel()
    



part/completion/katecompletionmodel.cpp
<http://git.reviewboard.kde.org/r/113917/#comment31552>

    this is now called in a begin/endResetModel block, which obsoletes these calls. \
Generally, this might explain also the speed slowdown, as the reset will trigger a \
full reload of the model, whereas this used to only remove/add what was actually \
changed.


- Milian Wolff


On Nov. 18, 2013, 10:32 a.m., Kevin Funk wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/113917/
> -----------------------------------------------------------
> 
> (Updated Nov. 18, 2013, 10:32 a.m.)
> 
> 
> Review request for Kate and Milian Wolff.
> 
> 
> Bugs: 236948
> http://bugs.kde.org/show_bug.cgi?id=236948
> 
> 
> Repository: kate
> 
> 
> Description
> -------
> 
> Fix assert in ~QPersistentModelIndex
> 
> KateCompletionWidget may call QAIM::setCurrentIndex during a reset of
> the model, inside KateCompletionWidget::modelContentChanged(). At this
> point, model indices are invalid, but QAIM wasn't informed about it.
> 
> The main problem is that KateCompletionModel doesn't use the
> (relatively) new {begin,end}ResetModel blocks to make persistent model indices
> invalid as soon as we start resetting the model. Instead reset() is used
> *after* we have reset the model. However, KateCompletionModel may emit
> contentGeometryChanged too early (before a reset()) and hence triggering
> QAIM::setCurrentIndex while QAIM is still referencing now invalid persistent model \
> indices. 
> Other changes:
> Remove contentGeometryChanged. Instead, use layoutChanged() and
> modelReset() signals to react to model changes.
> 
> BUG: 236948
> FIXED-IN: 4.13
> 
> 
> Diffs
> -----
> 
> part/completion/katecompletionmodel.h 5fedbccc37cd49b7403827dafce15b498e99b160 
> part/completion/katecompletionmodel.cpp 3fa8080ff95deb1e24327063ccd19dbb13ff49a8 
> part/completion/katecompletionwidget.cpp 4bb077e0973fd1eb9f1f5a7bb3e9bccae1a79511 
> 
> Diff: http://git.reviewboard.kde.org/r/113917/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Kevin Funk
> 
> 


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











<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://git.reviewboard.kde.org/r/113917/diff/2/?file=214728#file214728line1035" \
style="color: black; font-weight: bold; text-decoration: \
underline;">part/completion/katecompletionmodel.cpp</a>  <span style="font-weight: \
normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; \
">QString KateCompletionModel::commonPrefix(QModelIndex selectedIndex) \
const</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">1017</font></th>  <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="n">endResetModel</span><span class="p">();</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">if this is \
called from within setCurrentCompletion, you&#39;ll nest the reset signals - is this \
supported by Qt?

i.e.:

beginResetModel();
changeCompletions() -&gt;
beginResetModel();
endResetModel();
--&gt; setCurrentCompletion()
endResetModel()
</pre>
</div>
<br />

<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://git.reviewboard.kde.org/r/113917/diff/2/?file=214728#file214728line1116" \
style="color: black; font-weight: bold; text-decoration: \
underline;">part/completion/katecompletionmodel.cpp</a>  <span style="font-weight: \
normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">int \
KateCompletionModel::Group::orderNumber() const {</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">1113</font></th>  <td bgcolor="#ffffff" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">          <span \
class="n">beginRemoveRows</span><span class="p">(</span><span \
class="n">QModelIndex</span><span class="p">(),</span> <span \
class="n">row</span><span class="p">,</span> <span class="n">row</span><span \
class="p">);</span></pre></td>  <th bgcolor="#f0f0f0" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">1097</font></th>  <td bgcolor="#ffffff" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; ">          <span \
class="n">beginRemoveRows</span><span class="p">(</span><span \
class="n">QModelIndex</span><span class="p">(),</span> <span \
class="n">row</span><span class="p">,</span> <span class="n">row</span><span \
class="p">);</span></pre></td>  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">this is now \
called in a begin/endResetModel block, which obsoletes these calls. Generally, this \
might explain also the speed slowdown, as the reset will trigger a full reload of the \
model, whereas this used to only remove/add what was actually changed.</pre> </div>
<br />



<p>- Milian Wolff</p>


<br />
<p>On November 18th, 2013, 10:32 a.m. UTC, Kevin Funk 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 Kate and Milian Wolff.</div>
<div>By Kevin Funk.</div>


<p style="color: grey;"><i>Updated Nov. 18, 2013, 10:32 a.m.</i></p>







<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=236948">236948</a>


</div>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kate
</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;">Fix assert in ~QPersistentModelIndex

KateCompletionWidget may call QAIM::setCurrentIndex during a reset of
the model, inside KateCompletionWidget::modelContentChanged(). At this
point, model indices are invalid, but QAIM wasn&#39;t informed about it.

The main problem is that KateCompletionModel doesn&#39;t use the
(relatively) new {begin,end}ResetModel blocks to make persistent model indices
invalid as soon as we start resetting the model. Instead reset() is used
*after* we have reset the model. However, KateCompletionModel may emit
contentGeometryChanged too early (before a reset()) and hence triggering
QAIM::setCurrentIndex while QAIM is still referencing now invalid persistent model \
indices.

Other changes:
Remove contentGeometryChanged. Instead, use layoutChanged() and
modelReset() signals to react to model changes.

BUG: 236948
FIXED-IN: 4.13</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>part/completion/katecompletionmodel.h <span style="color: \
grey">(5fedbccc37cd49b7403827dafce15b498e99b160)</span></li>

 <li>part/completion/katecompletionmodel.cpp <span style="color: \
grey">(3fa8080ff95deb1e24327063ccd19dbb13ff49a8)</span></li>

 <li>part/completion/katecompletionwidget.cpp <span style="color: \
grey">(4bb077e0973fd1eb9f1f5a7bb3e9bccae1a79511)</span></li>

</ul>

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







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








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



_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel


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

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