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/qxcbconnection.h | |
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/qxcbconnection.h')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 354ba54e70..9e9865a2e9 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -355,6 +355,18 @@ public: typedef QHash<xcb_window_t, QXcbWindowEventListener *> WindowMapper; +class QXcbSyncWindowRequest : public QEvent +{ +public: + QXcbSyncWindowRequest(QXcbWindow *w) : QEvent(QEvent::Type(QEvent::User + 1)), m_window(w) { } + + QXcbWindow *window() const { return m_window; } + void invalidate(); + +private: + QXcbWindow *m_window; +}; + class QAbstractEventDispatcher; class QXcbConnection : public QObject { @@ -468,8 +480,10 @@ public: QXcbEventReader *eventReader() const { return m_reader; } +protected: + bool event(QEvent *e) Q_DECL_OVERRIDE; + public slots: - void syncWindow(QXcbWindow *window); void flush() { xcb_flush(m_connection); } private slots: |