Reset QWindowPrivate::platformWindow during destruction before deleting it
Otherwise the deletion of the platform window may result in platform events that then conclude the QWindow has a valid platform window and calls into it, when it's been half-way destroyed. Change-Id: If9eaad1b4e6aa414ba0f96475756a2146e0c01d5 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
This commit is contained in:
parent
542e11ab2b
commit
44c304cefb
@ -1882,11 +1882,16 @@ void QWindowPrivate::destroy()
|
||||
QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed);
|
||||
QGuiApplication::sendEvent(q, &e);
|
||||
|
||||
delete platformWindow;
|
||||
// Unset platformWindow before deleting, so that the destructor of the
|
||||
// platform window does not recurse back into the platform window via
|
||||
// this window during destruction (e.g. as a result of platform events).
|
||||
QPlatformWindow *pw = platformWindow;
|
||||
platformWindow = nullptr;
|
||||
delete pw;
|
||||
|
||||
resizeEventPending = true;
|
||||
receivedExpose = false;
|
||||
exposed = false;
|
||||
platformWindow = 0;
|
||||
|
||||
if (wasVisible)
|
||||
maybeQuitOnLastWindowClosed();
|
||||
|
Loading…
Reference in New Issue
Block a user