diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-07-31 16:20:49 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-08-01 20:42:31 +0200 |
commit | 61179c1447eb2b3fd43ca12d8b436cd73a0872a6 (patch) | |
tree | 3337eeadf8206ba4e1af22daaebf5a72d46432b9 /src/plugins/platforms/xcb/qglxintegration.cpp | |
parent | 751a74c339586d86bc5df0586e1cdcb886e381bb (diff) |
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 <gunnar.sletta@jollamobile.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src/plugins/platforms/xcb/qglxintegration.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qglxintegration.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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<QXcbWindow *>(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(); } } |