<table><tr><td style="">aacid added a comment.
</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/D9328" rel="noreferrer">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8;
          color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D9328#196555" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;" rel="noreferrer">D9328#196555</a>, <a href="https://phabricator.kde.org/p/rkflx/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;" rel="noreferrer">@rkflx</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><ol class="remarkup-list" start="5">
<li class="remarkup-list-item"><tt style="background: #ebebeb; font-size: 13px;">ASSERT: "page()" in file okular/core/generator_p.cpp, line 129</tt> (Happened two times already, but not everytime.)</li>
</ol></blockquote>

<p>You got this one changing the size of the sidebar?</p></blockquote>

<p>In fact, scrolling in almost every multipage document triggers the problem, which is quite serious. This was not there before (I checked specifically by only undoing the Okular patch).</p></div>
</blockquote>

<p>Ok, i found how to reproduce too and this should be fixed now.</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;">

<hr class="remarkup-hr" />

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><ol class="remarkup-list" start="6">
<li class="remarkup-list-item">Text page generation not cancellable</li>
</ol></blockquote>

<p>cancel text extraction on document close</p></blockquote>

<p>I'm still not sure whether it's not working correctly or I'm not understanding what "cancelling" means. In the following video, I <span><span class="phui-tag-view phui-tag-type-shade phui-tag-grey phui-tag-shade "><span class="phui-tag-core ">Close</span></span></span> during rendering (immediate reaction) and then I <span><span class="phui-tag-view phui-tag-type-shade phui-tag-grey phui-tag-shade "><span class="phui-tag-core ">Close</span></span></span> during text extraction (long delay):</p>

<p><a href="https://phabricator.kde.org/F5676037" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;" rel="noreferrer">F5676037: close-not-cancelling.webm</a></p></blockquote>

<p>Right, i did some more testing and sometimes  it doesn't cancel "as interactively" as you'd want, the problem is in two areas:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">Checking "should i cancel" too often will make it slower</li>
<li class="remarkup-list-item">If the code is not written in a way to exit early you'll end up with memory leaks</li>
</ul>

<p>I tried adding some more "should i cancel" to the poppler patch, and ended up with the second problem.</p>

<p>To simplify a bit text extraction is two things, "drawing" the text and then rearranging it in something that makes sense as sentences.</p>

<p>The "drawing" part is cancellable since it shares code with the actual drawing, but the rearranging doesn't really have support for it, and i've played with it a bit and it's not immediately obvious how to make it exit early without leaking. So I would really prefer if we would delay this as a future improvement.</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>To me this looks like text extraction in just one huge uninterruptible chunk, and only after it has finished Okular will react with whatever I wanted to do (in this case <span><span class="phui-tag-view phui-tag-type-shade phui-tag-grey phui-tag-shade "><span class="phui-tag-core ">Close</span></span></span>). The same happens for <span><span class="phui-tag-view phui-tag-type-shade phui-tag-grey phui-tag-shade "><span class="phui-tag-core ">Zoom In</span></span></span>, where text extraction is not "stopped" and thus I get to see the pixelated rendering for quite a while (I did not test any other actions yet):</p>

<p><a href="https://phabricator.kde.org/F5676039" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;" rel="noreferrer">F5676039: zoom-not-cancelling.webm</a></p></blockquote>

<p>This is "as designed", basically at that point the pixmap has been generated, the text is being generated and now we get a new pixmap request, but you already have "something to see" so in that case i decided to not cancel the text generation.</p></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/D9328" rel="noreferrer">https://phabricator.kde.org/D9328</a></div></div><br /><div><strong>To: </strong>aacid, ervin, rkflx<br /><strong>Cc: </strong>rkflx, ervin, michaelweghorn, ngraham, Okular, aacid<br /></div>