Reworked memory layout + misc improvements #22

wants to merge 10 commits into


None yet
1 participant

Reworked QSharedPointer into (mostly) QWeakPointer and improve thread safety - this also fixed some memory problems and intermittent crashes.

Allow to reload files if changed on disk

Implement PDFDocumentWidget to make inclusion in main Tw easier

Add some unit testing

I think this should settle most of the show stoppers. How do you feel about merging it back into trunk and start a first testing round for the "general public"?

stloeffler added some commits Sep 2, 2012

Make Document, Page, and the corresponding backend implementations th…

 - data access is now governed by the QReadWriteLock's _docLock and _pageLock
 - Pages can exist in a detached state where _parent == NULL (so a Document can
   discard them even when they are not destroyed, e.g., because another thread
   still holds a QSharedPointer to them)
 - some details and policies (for backend implementations) are collected in
Use QWeakPointer instead of QSharedPointer for passing around referen…
…ces to Document and Page objects

Only the respective owner should hold a permanent QSharedPointer to ensure the owned object is destroyed when the owner is destroyed. Any other object should only hold a QWeakPointer (to be able to check validity) and "upgrade" that to a QSharedPointer temporarily (using toStrongRef()) while accessing data.
Page objects are typically owned by the corresponding Document.
Document objects are typically owned by a PDFDocumentScene object.
Allow to reload a file if changed on disk
Whether a file is watched can be set using PDFDocumentScene::setWatchForDocumentChangesOnDisk() or its wrapper PDFDocumentWidget::setWatchForDocumentChangesOnDisk()
Implement BackendInterface to allow a choice of backends at run-time
 - New backends should implement BackendInterface
 - Use the interfaces to create new documents by means of the newDocument() method
Rename Poppler > PopplerQt4
It more accurately describes the framework/library used, and perhaps we'll add another backend based solely on the poppler library (and not on poppler-qt4) in the future.
Fix MuPDF page sizes
The unit test failed because only rounded sizes were returned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment