<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - library should be thread-safe"
href="https://bugs.freedesktop.org/show_bug.cgi?id=50992#c51">Comment # 51</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - library should be thread-safe"
href="https://bugs.freedesktop.org/show_bug.cgi?id=50992">bug 50992</a>
from <span class="vcard"><a class="email" href="mailto:Thomas.Freitag@alfa.de" title="Thomas Freitag <Thomas.Freitag@alfa.de>"> <span class="fn">Thomas Freitag</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=50992#c49">comment #49</a>)
<span class="quote">> (In reply to <a href="show_bug.cgi?id=50992#c47">comment #47</a>)
> > (In reply to <a href="show_bug.cgi?id=50992#c43">comment #43</a>)
> > > Created <span class="bz_obsolete"><a href="attachment.cgi?id=67636" name="attach_67636" title="more changes to get qt library thread safe">attachment 67636</a> <a href="attachment.cgi?id=67636&action=edit" title="more changes to get qt library thread safe">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=50992&attachment=67636'>[review]</a> [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.</span >
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.</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>