[poppler] UniqueFileStream and deleted files

Albert Astals Cid aacid at kde.org
Sat Mar 23 10:36:45 PDT 2013

We have found a problem in Okular that with the new UniqueFileStream class 
that has been introduced for multi-threaded rendering we crash when we try to 
render a file that has been deleted on disk.

This is because the UniqueFileStream::UniqueFileStream that we use to have 
different file pointers to read the xref, etc tries to reopen the file, but 
the file is gone and thus operations on it crash.

One option would be just returning false but that would be a sad thing since 
we are losing support for a feature we had.

Since we already have the file open we still ahve a vaild FILE that points to 
it, i'm suggesting that if in FileStream::copy we detect that the file is 
gone, we write it to a temporary location and keep using that one. It might be 
a bit slow the first time but can't think of other way of doing it (i tried to 
find a way to duplicate a FILE* but failed)



More information about the poppler mailing list