Recreating QGuiApplication is not a common case, ever. Plus no one said the QPixmap cache would be shared across QGuiApplication instances. I don't think that was the intention. In fact that could be used to access some data of another "run" meant to be destroyed/erased/forgotten.
Using QThreadStorage or at least qAddPostRoutine() sounds like a correct solution. Regards, Konstantin вс, 30 мая 2021 г. в 14:04, Giuseppe D'Angelo via Development < development@qt-project.org>: > 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 > > _______________________________________________ > Development mailing list > Development@qt-project.org > https://lists.qt-project.org/listinfo/development >
_______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development