stloeffler/TeXworks — comment on commit 1455178be2071a903a56ff044bfaf9d55e07383e
File: PDFViewer.cpp line 22
By stloeffler:

On 2011-10-30 18:30, Charlie Sharpsteen wrote:
> It is also possible that we may be over-using `QSharedPointer`. There is definitely some QA work that needs to be done on memory management and pointer usage.
>

I definitely agree. However, in the case of scenes, I'm quite sure we
need some sort of reference counting (regardless whether it's done with
a QSharedPointer or differently). The reason is that the PDFViewer,
which creates the scene, has no handle on it after the creation. Since,
on the other hand, we can in principle have any number of views
displaying the same scene (without them necessarily knowing of each
other), we can only (and have to) destroy the scene when it is no longer
used.

I did google a bit about reference counting and such, but `delete this;`
did not strike me as the way to go ;).

I rather wonder if all the pointers to Document and Page need to be
QSharedPointer - as there is usually some object owning them (e.g.,
pages are owned by the document, the document by the scene, etc.).