<table><tr><td style="">sitter created this revision.<br />sitter added a reviewer: Plasma.<br />Herald added a project: Plasma.<br />Herald added a subscriber: plasma-devel.<br />sitter requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D21801">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>this specifically unsets the m_highlighter which absolutely must not be<br />
present when in loading state (or more specifically: when receiving lines<br />
as-they-appear as opposed to the finished backtrace).<br />
also assert that the widget has no highlighter when loading lines</p>

<p>the highlighter design is fairly wonky, it actually highlights off of the<br />
qtextdocument, but to highlight it needs to know the actual parsed trace<br />
Line entities and they are of course no longer present because the<br />
document only has a text blob. to bridge that disconnect the highlighter<br />
needs to match up the textual lines to the Line entities by their index.<br />
naturally this is a potential bundle of segfault sources when the two<br />
sources no longer align.</p>

<p>unfortunately that is exactly what could happen:<br />
technically speaking drkonqi has two instances of backtracewidget. one<br />
in the main dialog and one in the report dialog. they both use the same<br />
generator though. so what happened was a confusion over which state the<br />
widget needs to be in vis a vis the generator. if the first widget already<br />
loaded a backtrace the generator would be in Loaded state and so would the<br />
widget (i.e. it'd have a highlighter). if the user then proceeds to the<br />
report dialog and they'd get a new widget with a reload button. if the user<br />
then would use the reload button the new widget would be fine, it would<br />
trigger a "reload". the old widget however would not know anything about<br />
the reload and continue to be in Loaded state with a highlighter attached.<br />
as the generator now sends lines to the old and the new widget, the old<br />
widget would receive the lines with a highlighter attached.<br />
bang! the (new) lines disalign with the Line entities in the highlighter<br />
and all hell breaks loose.</p>

<p>this quite possibly fixes all occurrences of the #381644 crasher, but I<br />
wouldn't exclude other points of frailty. as mentioned, the way the<br />
highlighter's connecting textual lines to Line entities is fairly<br />
fragile in of itself.</p>

<p>CHANGELOG: No longer crashes when reloading backtraces under certain circumstances<br />
BUG: 381644<br />
FIXED-IN: 5.16.1</p></div></div><br /><div><strong>TEST PLAN</strong><div><ul class="remarkup-list">
<li class="remarkup-list-item">killall -SEGV dolphin</li>
<li class="remarkup-list-item">open drkonqi</li>
<li class="remarkup-list-item">go to backtrace tab</li>
<li class="remarkup-list-item">let backtrace</li>
<li class="remarkup-list-item">click report bug</li>
<li class="remarkup-list-item">proceed to backtrace page</li>
<li class="remarkup-list-item">click reload</li>
<li class="remarkup-list-item">no crashy</li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R871 DrKonqi</div></div></div><br /><div><strong>BRANCH</strong><div><div>Plasma/5.16</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D21801">https://phabricator.kde.org/D21801</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/backtracewidget.cpp</div></div></div><br /><div><strong>To: </strong>sitter, Plasma<br /><strong>Cc: </strong>plasma-devel, LeGast00n, ericadams, jraleigh, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>