From 307e473759d1268b50a087095cc005c941f3bb0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Fri, 19 Apr 2024 19:48:11 +0100 Subject: [PATCH] core: fix initialization issues in LockSurface (#285) * LockSurface: handle uninitialized eglWindow in destructor * LockSurface: don't render before configuration --- src/core/LockSurface.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/LockSurface.cpp b/src/core/LockSurface.cpp index 3223049..d0acd5f 100644 --- a/src/core/LockSurface.cpp +++ b/src/core/LockSurface.cpp @@ -28,7 +28,10 @@ CSessionLockSurface::~CSessionLockSurface() { wp_viewport_destroy(viewport); wp_fractional_scale_v1_destroy(fractional); } - wl_egl_window_destroy(eglWindow); + + if (eglWindow) + wl_egl_window_destroy(eglWindow); + ext_session_lock_surface_v1_destroy(lockSurface); wl_surface_destroy(surface); if (frameCallback) @@ -116,7 +119,7 @@ static const wl_callback_listener callbackListener = { void CSessionLockSurface::render() { Debug::log(TRACE, "render lock"); - if (frameCallback) + if (frameCallback || !readyForFrame) return; const auto FEEDBACK = g_pRenderer->renderLock(*this); @@ -129,7 +132,6 @@ void CSessionLockSurface::render() { } void CSessionLockSurface::onCallback() { - readyForFrame = true; frameCallback = nullptr; if (needsFrame && !g_pHyprlock->m_bTerminate && g_pEGL)