[Poppler-bugs] [Bug 50992] library should be thread-safe
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Wed Sep 26 00:29:13 PDT 2012
https://bugs.freedesktop.org/show_bug.cgi?id=50992
--- Comment #51 from Thomas Freitag <Thomas.Freitag at alfa.de> ---
(In reply to comment #49)
> (In reply to comment #47)
> > (In reply to comment #43)
> > > Created attachment 67636 [details] [review] [review] [review]
> > > more changes to get qt library thread safe
> > >
> > > This patch also inlcudes the changes from Adam. I went through the code of
> > > okular and tried to make all calls of the poppler qt library thread safe.
> >
> > What are the incref and decref in Document supposed to do?
>
> I think they are supposed to the delete the document instance after the last
> thread that uses it has finished which might be after the thread that create
> it. Otherwise, the main, e.g. GUI, thread would have to wait for all work
> threads to finish before deletion.
Or in other words: if You share an instance of an object (not even over
threads) the call of the destructor is no more safe. You have to count the
references to the instance and can call the destructor when the reference count
become 0. The style I did it is how it is also done in several other places in
poppler.
In practise: If You start printing a PDF in background and call "Close" in the
main thread before printing has finished You have to delete the instance of the
document when printing has finished. That is what incRefCnt and decRefCnt
guarantees.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler-bugs/attachments/20120926/6c6c9c3d/attachment.html>
More information about the Poppler-bugs
mailing list