Client: Make handleUpdate aware of exposure changes
The wl_surface can be destroyed whilst a render is happening. Calling wl_surface::frame after the window is reset can crash as wl_surface is null. Fixes: QTBUG-77747 Change-Id: I139a9b234cb6acba81d6c1d5fa58629904a25053 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
cb68cead89
commit
b4ee20efff
@ -210,6 +210,8 @@ void QWaylandWindow::initWindow()
|
||||
|
||||
void QWaylandWindow::initializeWlSurface()
|
||||
{
|
||||
Q_ASSERT(!isInitialized());
|
||||
QWriteLocker lock(&mSurfaceLock);
|
||||
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
|
||||
}
|
||||
|
||||
@ -245,8 +247,10 @@ void QWaylandWindow::reset(bool sendDestroyEvent)
|
||||
mShellSurface = nullptr;
|
||||
delete mSubSurfaceWindow;
|
||||
mSubSurfaceWindow = nullptr;
|
||||
if (isInitialized())
|
||||
if (isInitialized()) {
|
||||
QWriteLocker lock(&mSurfaceLock);
|
||||
destroy();
|
||||
}
|
||||
mScreens.clear();
|
||||
|
||||
if (mFrameCallback) {
|
||||
@ -1147,6 +1151,9 @@ void QWaylandWindow::requestUpdate()
|
||||
void QWaylandWindow::handleUpdate()
|
||||
{
|
||||
// TODO: Should sync subsurfaces avoid requesting frame callbacks?
|
||||
QReadLocker lock(&mSurfaceLock);
|
||||
if (!isInitialized())
|
||||
return;
|
||||
|
||||
if (mFrameCallback) {
|
||||
wl_callback_destroy(mFrameCallback);
|
||||
|
@ -53,6 +53,8 @@
|
||||
|
||||
#include <QtCore/QWaitCondition>
|
||||
#include <QtCore/QMutex>
|
||||
#include <QtCore/QReadWriteLock>
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QLoggingCategory>
|
||||
@ -272,6 +274,8 @@ private:
|
||||
static QMutex mFrameSyncMutex;
|
||||
static QWaylandWindow *mMouseGrab;
|
||||
|
||||
QReadWriteLock mSurfaceLock;
|
||||
|
||||
friend class QWaylandSubSurface;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user