Hi, On 30/05/2021 07:28, Sze Howe Koh wrote:
So, I propose replacing QGlobalStatic<QPMCache> with QPointer<QPMCache> as a simple self-cleaning singleton, and replacing access to the global variable with QPMCache::instance():
I'd tend to agree with idea, but not with the specific solution. You may want
1) to keep the cache alive across multiple QGA::exec() invocations, 2) to destroy it only when QGA gets destroyed, 3) to recreate it if QGA itself gets recreated.A very simple solution is to make the cache a member of QGA(P), create it lazily if needed (like Q_G_S does; but I've got the funny feeling that the pixmap cache is used in 100% Qt apps, so maybe that's not even needed), and kill it in ~QGA.
I believe this approach should also take care of the ancient QTBUG-21807 [5]
This has already been fixed, actually, in 5.0:
https://github.com/qt/qtbase/commit/6615dc1370300188f2979fb2c6b8eaa6049d5824
Thanks, -- Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer KDAB (France) S.A.S., a KDAB Group company Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com KDAB - The Qt, C++ and OpenGL Experts
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development