summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-01-03 18:33:56 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-01-06 16:30:00 +0000
commit5da5586a96bbb80e46065b1da847126b9fdb558f (patch)
tree53e0d02913e97670df7e11edacee6e1a59dedaec /src/plugins/platforms/ios
parent3c99bddb8469416b0042db6a39ec2e9d82b147a1 (diff)
iOS: Ensure that QPlatformBackingStore can clean up textures in dtor
We are using QPlatformBackingStore::composeAndFlush, which allocates textures on our behalf using the context that we pass in, so we need to keep the context alive (and make it current) for the duration of the QPlatformBackingStore destructor, otherwise we're leaking textures every time a window (dialog e.g.) is closed. Change-Id: I1450fa0ff7a170d13ec59920566e4401b50cd513 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r--src/plugins/platforms/ios/qiosbackingstore.mm12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/platforms/ios/qiosbackingstore.mm b/src/plugins/platforms/ios/qiosbackingstore.mm
index 076e34c1a5..96be28af81 100644
--- a/src/plugins/platforms/ios/qiosbackingstore.mm
+++ b/src/plugins/platforms/ios/qiosbackingstore.mm
@@ -122,7 +122,17 @@ QIOSBackingStore::QIOSBackingStore(QWindow *window)
QIOSBackingStore::~QIOSBackingStore()
{
- delete m_context;
+ if (window()->surfaceType() == QSurface::RasterGLSurface) {
+ // We're using composeAndFlush from QPlatformBackingStore, which
+ // need to clean up any textures in its destructor, so make the
+ // context current and keep it alive until QPlatformBackingStore
+ // has cleaned up everything.
+ makeCurrent();
+ m_context->deleteLater();
+ } else {
+ delete m_context;
+ }
+
delete m_glDevice;
}