Re: [Development] Removing the global static QObject from QPixmapCache

2021-05-30 Thread Konstantin Ritt
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 QThreadSto

Re: [Development] Removing the global static QObject from QPixmapCache

2021-05-30 Thread Lorn Potter
On 30/5/21 3:28 PM, Sze Howe Koh wrote: This also causes problems when the QGuiApplication is created in a std::thread instead of in main() (e.g. when a non-Qt application loads a Qt-based plugin to display a GUI) -- The QPMCache destructor is run by the wrong thread, which produces a warning,

Re: [Development] Removing the global static QObject from QPixmapCache

2021-05-30 Thread Giuseppe D'Angelo via Development
On 30/05/2021 17:47, Konstantin Shegunov wrote: I was simply teasing. I was referring to this thread about QTBUG-71545[1], where I wanted the application to destroy its children explicitly so they see it as QCA, but I wasn't convincing enough. Whereas QWidget(s) are doing it in their destructor

Re: [Development] Removing the global static QObject from QPixmapCache

2021-05-30 Thread Konstantin Shegunov
On Sun, May 30, 2021 at 6:14 PM Giuseppe D'Angelo wrote: > > That should work, but it'd be one of them "exceptions", wouldn't it ...? > ;) > > Sorry, exceptions to what? > I was simply teasing. I was referring to this thread about QTBUG-71545[1], where I wanted the application to destroy its chi

Re: [Development] Removing the global static QObject from QPixmapCache

2021-05-30 Thread Giuseppe D'Angelo via Development
On 30/05/2021 14:11, Konstantin Shegunov wrote: 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

Re: [Development] Removing the global static QObject from QPixmapCache

2021-05-30 Thread Konstantin Shegunov
On Sun, May 30, 2021 at 2:05 PM Giuseppe D'Angelo via Development < development@qt-project.org> wrote: > 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 des

Re: [Development] Removing the global static QObject from QPixmapCache

2021-05-30 Thread Giuseppe D'Angelo via Development
Hi, On 30/05/2021 07:28, Sze Howe Koh wrote: So, I propose replacing QGlobalStatic with QPointer 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 k