366 | @@ -364,7 +367,7 @@ void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
367 |
368 | void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
369 | {
370 | - SplashScreen *splash = new SplashScreen(0, networkStyle);
371 | + splash = new SplashScreen(0, networkStyle);
372 | // We don't hold a direct pointer to the splash screen after creation, so use
373 | // Qt::WA_DeleteOnClose to make sure that the window will be deleted eventually.
374 | splash->setAttribute(Qt::WA_DeleteOnClose);
You should remove this deleteonclose if you want to hold on to a pointer and/or manually delete the splash screen.
Note that this changes the lifetime of the splash to the lifetime of the entire application instead of just while it is visible.
Oh. Yes. Let me keep the WA_DeleteOnClose and remove the explicit deconstruction.
But then you're not allowed to store a pointer to it, so you can't explicitly close it in this way.
What you can do is make the splash subscribe to a signal that hides it.
Eh such a signal exists: splashFinished
Thanks!
Right. I though WA_DeleteOnClose would nullify the pointer. But right, thats not possible.
Let me adapt the signals approach.
right - a "weak pointer" (qt has one in the form of QWeakPointer) would have that behavior, but it'd be overkill here