a0119ff1d2
1 OBS-URL: https://build.opensuse.org/request/show/501456 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=59
101 lines
3.2 KiB
Diff
101 lines
3.2 KiB
Diff
From 32390f49291308eb85dcbcaa898bbf825a2eb229 Mon Sep 17 00:00:00 2001
|
|
From: =?utf8?q?Tor=20Arne=20Vestb=C3=B8?= <tor.arne.vestbo@qt.io>
|
|
Date: Fri, 2 Jun 2017 11:09:55 +0200
|
|
Subject: [PATCH] xcb: Don't destroy foreign windows
|
|
|
|
We can't rely on virtual dispatch in the destructor.
|
|
|
|
Task-number: QTBUG-61140
|
|
Change-Id: Ib1026caf126095778c24254775cb5a0bfecf3a38
|
|
---
|
|
src/plugins/platforms/xcb/qxcbintegration.cpp | 18 +-----------------
|
|
src/plugins/platforms/xcb/qxcbwindow.cpp | 16 ++++++++++------
|
|
src/plugins/platforms/xcb/qxcbwindow.h | 12 ++++++++++++
|
|
3 files changed, 23 insertions(+), 23 deletions(-)
|
|
|
|
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
|
|
index b414bee..8e3ee20 100644
|
|
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
|
|
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
|
|
@@ -214,25 +214,9 @@ QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const
|
|
return xcbWindow;
|
|
}
|
|
|
|
-class QXcbForeignWindow : public QXcbWindow
|
|
-{
|
|
-public:
|
|
- QXcbForeignWindow(QWindow *window, WId nativeHandle)
|
|
- : QXcbWindow(window) { m_window = nativeHandle; }
|
|
- ~QXcbForeignWindow() {}
|
|
- bool isForeignWindow() const override { return true; }
|
|
-
|
|
-protected:
|
|
- // No-ops
|
|
- void create() override {}
|
|
- void destroy() override {}
|
|
-};
|
|
-
|
|
QPlatformWindow *QXcbIntegration::createForeignWindow(QWindow *window, WId nativeHandle) const
|
|
{
|
|
- QXcbWindow *xcbWindow = new QXcbForeignWindow(window, nativeHandle);
|
|
- xcbWindow->create();
|
|
- return xcbWindow;
|
|
+ return new QXcbForeignWindow(window, nativeHandle);
|
|
}
|
|
|
|
#ifndef QT_NO_OPENGL
|
|
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
|
|
index 289d072..d6c69d5 100644
|
|
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
|
|
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
|
|
@@ -597,13 +597,17 @@ QXcbWindow::~QXcbWindow()
|
|
}
|
|
|
|
destroy();
|
|
+}
|
|
|
|
- if (isForeignWindow()) {
|
|
- if (connection()->mouseGrabber() == this)
|
|
- connection()->setMouseGrabber(Q_NULLPTR);
|
|
- if (connection()->mousePressWindow() == this)
|
|
- connection()->setMousePressWindow(Q_NULLPTR);
|
|
- }
|
|
+QXcbForeignWindow::~QXcbForeignWindow()
|
|
+{
|
|
+ // Clear window so that destroy() does not affect it
|
|
+ m_window = 0;
|
|
+
|
|
+ if (connection()->mouseGrabber() == this)
|
|
+ connection()->setMouseGrabber(nullptr);
|
|
+ if (connection()->mousePressWindow() == this)
|
|
+ connection()->setMousePressWindow(nullptr);
|
|
}
|
|
|
|
void QXcbWindow::destroy()
|
|
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
|
|
index 5662809..f38343b 100644
|
|
--- a/src/plugins/platforms/xcb/qxcbwindow.h
|
|
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
|
|
@@ -278,6 +278,18 @@ protected:
|
|
xcb_cursor_t m_currentBitmapCursor = XCB_CURSOR_NONE;
|
|
};
|
|
|
|
+class QXcbForeignWindow : public QXcbWindow
|
|
+{
|
|
+public:
|
|
+ QXcbForeignWindow(QWindow *window, WId nativeHandle)
|
|
+ : QXcbWindow(window) { m_window = nativeHandle; }
|
|
+ ~QXcbForeignWindow();
|
|
+ bool isForeignWindow() const override { return true; }
|
|
+
|
|
+protected:
|
|
+ void create() override {} // No-op
|
|
+};
|
|
+
|
|
QT_END_NAMESPACE
|
|
|
|
Q_DECLARE_METATYPE(QXcbWindow*)
|
|
--
|
|
2.7.4
|
|
|