<table><tr><td style="">tobiasdeiminger created this revision.<br />tobiasdeiminger added a reviewer: Okular.<br />tobiasdeiminger added a project: Okular.<br />tobiasdeiminger 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/D9852" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Fixes BUG: 388228. Diff applies to Applications/17.12, and should be easy to merge to master. It's kept quite minimal as suggested by Albert.</p>

<p>Albert also suggested to add a dedicated unit test and I'd agree, but am not yet sure how to do it. The original bug involves several classes, including UI: Document, Page, AddAnnotationCommand, PageView, PageViewAnnotator, MouseAnnotation - to name a few. So a test for the exact bug scenario would become a bigger integration test rather than an isolated unit test. The other approach would be to do a real unit test on MouseAnnotation. But again, MouseAnnotation has nasty dependencies (e.g., needs a parent PageView) which I'd have to mock. Any ideas? I'd be interested in a discussion on this topic.</p></div></div><br /><div><strong>TEST PLAN</strong><div><ol class="remarkup-list">
<li class="remarkup-list-item">Load a document (e.g. <a href="http://www.philipebert.info/resources/WhatMathematicalKnowledgeCouldNotBe.pdf" class="remarkup-link" target="_blank" rel="noreferrer">linked PDF from bug report</a>) and enable highlight toolbar (F6).</li>
<li class="remarkup-list-item">Create highlight annotation.</li>
<li class="remarkup-list-item">Move the view port so that the annotation position is right beside the highlight tool icon.</li>
<li class="remarkup-list-item">Move the mouse over the annotation, and then horizontally left until you reach the tool icon; it's important to stay over the highlight annotation as long as in viewport.</li>
<li class="remarkup-list-item">Press ctrl-z for undo.</li>
<li class="remarkup-list-item">Click on highlight tool, move right into the document, create new highlight annotation.</li>
<li class="remarkup-list-item">Okular doesn't crash.</li>
</ol></div></div><br /><div><strong>REPOSITORY</strong><div><div>R223 Okular</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D9852" rel="noreferrer">https://phabricator.kde.org/D9852</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>ui/pageview.cpp<br />
ui/pageviewmouseannotation.cpp<br />
ui/pageviewmouseannotation.h</div></div></div><br /><div><strong>To: </strong>tobiasdeiminger, Okular<br /><strong>Cc: </strong>michaelweghorn, gassaf, ngraham, aacid<br /></div>