<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:haxtibal@posteo.de" title="Tobias Deiminger <haxtibal@posteo.de>"> <span class="fn">Tobias Deiminger</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Patch] Skip XRef gaps in PDFDoc save methods"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107057">bug 107057</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #140484 is obsolete</td>
           <td>
                
           </td>
           <td>1
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Patch] Skip XRef gaps in PDFDoc save methods"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107057#c15">Comment # 15</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Patch] Skip XRef gaps in PDFDoc save methods"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107057">bug 107057</a>
              from <span class="vcard"><a class="email" href="mailto:haxtibal@posteo.de" title="Tobias Deiminger <haxtibal@posteo.de>"> <span class="fn">Tobias Deiminger</span></a>
</span></b>
        <pre>Created <span class=""><a href="attachment.cgi?id=140530" name="attach_140530" title="Skip XRef::constructXRef in XRef::readXRefUntil if last XRef section is a stream">attachment 140530</a> <a href="attachment.cgi?id=140530&action=edit" title="Skip XRef::constructXRef in XRef::readXRefUntil if last XRef section is a stream">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=107057&attachment=140530'>[review]</a>
Skip XRef::constructXRef in XRef::readXRefUntil if last XRef section is a
stream

Here's an approach to avoid the problem described in <a href="show_bug.cgi?id=107057#c14">comment 14</a>. We let the
lazy load during PDFDoc::saveXXX happen, but avoid corruption of the XRef by
skipping constructXRef in XRef::readXRefUntil for situations where we know it
won't work.

Afaikt XRef::fetch does the same for the same reason, checkout commit 57b7a52c.

When using the patch in the okular test case, we'll get a single "Error:
Invalid XRef entry 0" on console, but saved file works. I think that's ok, as
the original file is actually buggy and it should be noted somewhere.

Tests from <a href="show_bug.cgi?id=107057#c1">comment 1</a> pass.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>