From 4bd13402f0293e85b8dfdf92254e250ac28094c7 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 8 Apr 2020 18:19:00 +0100 Subject: Client: Reset wl_egl_window before wl_surface Semantically we want things in this order as wl_egl_window_create takes a reference to the wl_surface. Teardown typically is the opposite of construction. This brings us in line with GTK which also tears down in this order. This fixes a repeatable crash when using Nvidia's EGLStreams and closing a window. Change-Id: I356dfbba9a7315717c8ecdc7023ca7b047622697 Reviewed-by: Frederik Gladhorn Reviewed-by: Johan Helsing --- src/client/qwaylandwindow.cpp | 2 ++ src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp | 7 ------- src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h | 1 - 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 5830c1368..9fa2f15f5 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -244,6 +244,8 @@ void QWaylandWindow::reset(bool sendDestroyEvent) mShellSurface = nullptr; delete mSubSurfaceWindow; mSubSurfaceWindow = nullptr; + + invalidateSurface(); if (mSurface) { emit wlSurfaceDestroyed(); QWriteLocker lock(&mSurfaceLock); diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp index e8d43fad4..7889f575f 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp @@ -162,13 +162,6 @@ QSurfaceFormat QWaylandEglWindow::format() const return m_format; } -void QWaylandEglWindow::setVisible(bool visible) -{ - QWaylandWindow::setVisible(visible); - if (!visible) - invalidateSurface(); -} - void QWaylandEglWindow::invalidateSurface() { if (m_eglSurface) { diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h index 878532afc..5b1f4d56f 100644 --- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h +++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h @@ -75,7 +75,6 @@ public: void bindContentFBO(); void invalidateSurface() override; - void setVisible(bool visible) override; private: QWaylandEglClientBufferIntegration *m_clientBufferIntegration = nullptr; -- cgit v1.2.3