diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-04-03 16:04:05 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-04-04 09:36:12 +0000 |
commit | de4aeade5ed86b008e6d497563cfcce9583b0c59 (patch) | |
tree | 67017456385ecce11d8cdb33844942b5cca434aa /src/gui/kernel/qrasterwindow.cpp | |
parent | 0d12ebd7e7e4de2c60faa443c9e711bba281de88 (diff) |
Delete QRasterWindow backingstore while window is still alive
The platform backingstore might need access to the window that the
backingstore was created for, e.g. for makingCurrent to release OpenGL
resources. In that case leaving it to the QRasterWindowPrivate destructor
would be too late, as the QWindow was gone.
This was seen on iOS, where the backingstore inherits QRasterBackingStore,
and uses composeAndFlush to composit via GL. The raster backingstore
cleans up these GL resources in its destructor, so the QIOSBackingStore
destructor makes sure that the GL context is current for the window,
resulting in a crash since the window is long gone by then.
Change-Id: I5a22597842819f0fe3b580856b9e75e4fab32ae5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/gui/kernel/qrasterwindow.cpp')
-rw-r--r-- | src/gui/kernel/qrasterwindow.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/kernel/qrasterwindow.cpp b/src/gui/kernel/qrasterwindow.cpp index d8d448249e..73871e0f39 100644 --- a/src/gui/kernel/qrasterwindow.cpp +++ b/src/gui/kernel/qrasterwindow.cpp @@ -105,6 +105,14 @@ QRasterWindow::QRasterWindow(QWindow *parent) d_func()->backingstore.reset(new QBackingStore(this)); } +QRasterWindow::~QRasterWindow() +{ + Q_D(QRasterWindow); + // Delete backingstore while window is still alive, as it + // might need to reference the window in the process + d->backingstore.reset(nullptr); +} + /*! \internal */ |