xcb: Don't destroy foreign windows
We can't rely on virtual dispatch in the destructor. Task-number: QTBUG-61140 Change-Id: Ib1026caf126095778c24254775cb5a0bfecf3a38 Reviewed-by: Fabian Vogt Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
This commit is contained in:
parent
94a2aec05b
commit
744fd39e66
@ -214,25 +214,9 @@ QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const
|
|||||||
return xcbWindow;
|
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
|
QPlatformWindow *QXcbIntegration::createForeignWindow(QWindow *window, WId nativeHandle) const
|
||||||
{
|
{
|
||||||
QXcbWindow *xcbWindow = new QXcbForeignWindow(window, nativeHandle);
|
return new QXcbForeignWindow(window, nativeHandle);
|
||||||
xcbWindow->create();
|
|
||||||
return xcbWindow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_OPENGL
|
#ifndef QT_NO_OPENGL
|
||||||
|
@ -597,13 +597,17 @@ QXcbWindow::~QXcbWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroy();
|
destroy();
|
||||||
|
}
|
||||||
|
|
||||||
if (isForeignWindow()) {
|
QXcbForeignWindow::~QXcbForeignWindow()
|
||||||
if (connection()->mouseGrabber() == this)
|
{
|
||||||
connection()->setMouseGrabber(Q_NULLPTR);
|
// Clear window so that destroy() does not affect it
|
||||||
if (connection()->mousePressWindow() == this)
|
m_window = 0;
|
||||||
connection()->setMousePressWindow(Q_NULLPTR);
|
|
||||||
}
|
if (connection()->mouseGrabber() == this)
|
||||||
|
connection()->setMouseGrabber(nullptr);
|
||||||
|
if (connection()->mousePressWindow() == this)
|
||||||
|
connection()->setMousePressWindow(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QXcbWindow::destroy()
|
void QXcbWindow::destroy()
|
||||||
|
@ -278,6 +278,18 @@ protected:
|
|||||||
xcb_cursor_t m_currentBitmapCursor = XCB_CURSOR_NONE;
|
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
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QXcbWindow*)
|
Q_DECLARE_METATYPE(QXcbWindow*)
|
||||||
|
Loading…
Reference in New Issue
Block a user