[Poppler-bugs] [Bug 50992] library should be thread-safe

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jan 14 15:44:03 PST 2013


https://bugs.freedesktop.org/show_bug.cgi?id=50992

--- Comment #140 from Albert Astals Cid <tsdgeos at terra.es> ---
Test Regression is good, horray!

Now let's look at the code :-)

First the small easy stuff ;-)

In the qt4 frotend there's this change

-       m_doc->doc->getDocInfo( &info );
-       if ( !info.isDict() )
+       XRef *xref = m_doc->doc->getXRef()->copy();
+       Object *infoObj = xref->getDocInfo(&info);
+       if ( !infoObj->isDict() ) {
            return QStringList();
+       }

-       Dict *infoDict = info.getDict();
+       Dict *infoDict = infoObj->getDict();


Any reason we can not keep using info? i.e. something like

-       m_doc->doc->getDocInfo( &info );
+       XRef *xref = m_doc->doc->getXRef()->copy();
+       xref->getDocInfo(&info);
        if ( !info.isDict() )
            return QStringList();

        Dict *infoDict = info.getDict();



Rest of the code looks good, i'd introduce two improvements, but let's do it
*LATER*, one introducing something similar to the concept of the mutexlocker
that unlocks the mutex on destruction (making it much easier to deal if early
returns, etc) and second changing some of the lock booleans to enums so 
   page = doc->getCatalog()->findPage (ref.num, ref.gen, gFalse);
looks like
   page = doc->getCatalog()->findPage (ref.num, ref.gen, Poppler::DoNotLock);
making the code a bit easier to read when you go around

I'm happy with the current state expect the minor question about the qt4
frontend.

Anyone else has any comment?

-- 
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/20130114/a6f3cc42/attachment.html>


More information about the Poppler-bugs mailing list