Make sure doApplyConfigure() is called from main thread
Task-number: QTBUG-101948 Change-Id: I867365384c43ccddf5b7a8600a3db84aa99aca6d Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
446508bea7
commit
d66e8f148f
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QThread>
|
#include <QtCore/QThread>
|
||||||
|
#include <QtCore/private/qthread_p.h>
|
||||||
|
|
||||||
#include <QtWaylandClient/private/qwayland-fractional-scale-v1.h>
|
#include <QtWaylandClient/private/qwayland-fractional-scale-v1.h>
|
||||||
|
|
||||||
@ -599,12 +600,24 @@ void QWaylandWindow::doApplyConfigure()
|
|||||||
if (!mWaitingToApplyConfigure)
|
if (!mWaitingToApplyConfigure)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Q_ASSERT_X(QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed(),
|
||||||
|
"QWaylandWindow::doApplyConfigure", "not called from main thread");
|
||||||
|
|
||||||
if (mShellSurface)
|
if (mShellSurface)
|
||||||
mShellSurface->applyConfigure();
|
mShellSurface->applyConfigure();
|
||||||
|
|
||||||
mWaitingToApplyConfigure = false;
|
mWaitingToApplyConfigure = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QWaylandWindow::doApplyConfigureFromOtherThread()
|
||||||
|
{
|
||||||
|
QMutexLocker lock(&mResizeLock);
|
||||||
|
if (!mCanResize || !mWaitingToApplyConfigure)
|
||||||
|
return;
|
||||||
|
doApplyConfigure();
|
||||||
|
sendExposeEvent(QRect(QPoint(), geometry().size()));
|
||||||
|
}
|
||||||
|
|
||||||
void QWaylandWindow::setCanResize(bool canResize)
|
void QWaylandWindow::setCanResize(bool canResize)
|
||||||
{
|
{
|
||||||
QMutexLocker lock(&mResizeLock);
|
QMutexLocker lock(&mResizeLock);
|
||||||
@ -615,8 +628,13 @@ void QWaylandWindow::setCanResize(bool canResize)
|
|||||||
QWindowSystemInterface::handleGeometryChange(window(), geometry());
|
QWindowSystemInterface::handleGeometryChange(window(), geometry());
|
||||||
}
|
}
|
||||||
if (mWaitingToApplyConfigure) {
|
if (mWaitingToApplyConfigure) {
|
||||||
doApplyConfigure();
|
bool inGuiThread = QThread::currentThreadId() == QThreadData::get2(thread())->threadId.loadRelaxed();
|
||||||
sendExposeEvent(QRect(QPoint(), geometry().size()));
|
if (inGuiThread) {
|
||||||
|
doApplyConfigure();
|
||||||
|
sendExposeEvent(QRect(QPoint(), geometry().size()));
|
||||||
|
} else {
|
||||||
|
QMetaObject::invokeMethod(this, &QWaylandWindow::doApplyConfigureFromOtherThread, Qt::QueuedConnection);
|
||||||
|
}
|
||||||
} else if (mResizeDirty) {
|
} else if (mResizeDirty) {
|
||||||
mResizeDirty = false;
|
mResizeDirty = false;
|
||||||
sendExposeEvent(QRect(QPoint(), geometry().size()));
|
sendExposeEvent(QRect(QPoint(), geometry().size()));
|
||||||
|
@ -321,6 +321,9 @@ protected:
|
|||||||
QPointer<QWaylandWindow> mTransientParent;
|
QPointer<QWaylandWindow> mTransientParent;
|
||||||
QList<QPointer<QWaylandWindow>> mChildPopups;
|
QList<QPointer<QWaylandWindow>> mChildPopups;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void doApplyConfigureFromOtherThread();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setGeometry_helper(const QRect &rect);
|
void setGeometry_helper(const QRect &rect);
|
||||||
void initWindow();
|
void initWindow();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user