From 61179c1447eb2b3fd43ca12d8b436cd73a0872a6 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 31 Jul 2014 16:20:49 +0200 Subject: Avoid calling syncWindow with already destroyed platform windows Issuing a metacall from swapBuffers is dangerous since the window may get destroyed by the time the slot is invoked. This patch changes it to use an event, which is more efficient anyway, that can be invalidated in case the QXcbWindow is destroy()'ed before the event is delivered. Change-Id: I44618ac1cb8b221aecce001ea39702164dcab6a5 Reviewed-by: Gunnar Sletta Reviewed-by: Uli Schlachter --- src/plugins/platforms/xcb/qglxintegration.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms/xcb/qglxintegration.cpp') diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 45ccd9929e..3ce0041aeb 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -523,11 +523,11 @@ void QGLXContext::swapBuffers(QPlatformSurface *surface) if (surface->surface()->surfaceClass() == QSurface::Window) { QXcbWindow *platformWindow = static_cast(surface); - // OpenGL context might be bound to a non-gui thread - // use QueuedConnection to sync the window from the platformWindow's thread - // as QXcbWindow is no QObject, a wrapper slot in QXcbConnection is used. + // OpenGL context might be bound to a non-gui thread use QueuedConnection to sync + // the window from the platformWindow's thread as QXcbWindow is no QObject, an + // event is sent to QXcbConnection. (this is faster than a metacall) if (platformWindow->needsSync()) - QMetaObject::invokeMethod(m_screen->connection(), "syncWindow", Qt::QueuedConnection, Q_ARG(QXcbWindow*, platformWindow)); + platformWindow->postSyncWindowRequest(); } } -- cgit v1.2.3