From 122a9512fc2e22ace1caf897d9b99ae5a26e9907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 8 Jun 2020 23:03:36 +0200 Subject: [PATCH] macOS: Add a few more local autorelease pools to QCocoaGLContext MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents buildup of autoreleased NSViews (drawables) in the outer pool of the main runloop, which may not drain as often as we wish. Change-Id: Ifcf7317c50ec243e0d957bf4a19aab8bf34d5dd6 Fixes: QTBUG-84762 Reviewed-by: Timur Pocheptsov (cherry picked from commit 15456efa20eb302ad2bc130d0d18db7d2fe58f4d) Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 915836113cd..c8b5365a752 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -357,6 +357,8 @@ QCocoaGLContext::~QCocoaGLContext() bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface) { + QMacAutoReleasePool pool; + qCDebug(lcQpaOpenGLContext) << "Making" << m_context << "current" << "in" << QThread::currentThread() << "for" << surface; @@ -479,6 +481,8 @@ void QCocoaGLContext::update() void QCocoaGLContext::swapBuffers(QPlatformSurface *surface) { + QMacAutoReleasePool pool; + qCDebug(lcQpaOpenGLContext) << "Swapping" << m_context << "in" << QThread::currentThread() << "to" << surface; @@ -512,6 +516,8 @@ void QCocoaGLContext::swapBuffers(QPlatformSurface *surface) void QCocoaGLContext::doneCurrent() { + QMacAutoReleasePool pool; + qCDebug(lcQpaOpenGLContext) << "Clearing current context" << [NSOpenGLContext currentContext] << "in" << QThread::currentThread();