core: fix initialization issues in LockSurface (#285)

* LockSurface: handle uninitialized eglWindow in destructor

* LockSurface: don't render before configuration
This commit is contained in:
André Silva 2024-04-19 19:48:11 +01:00 committed by GitHub
parent 2bce52f094
commit 307e473759
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -28,7 +28,10 @@ CSessionLockSurface::~CSessionLockSurface() {
wp_viewport_destroy(viewport); wp_viewport_destroy(viewport);
wp_fractional_scale_v1_destroy(fractional); wp_fractional_scale_v1_destroy(fractional);
} }
if (eglWindow)
wl_egl_window_destroy(eglWindow); wl_egl_window_destroy(eglWindow);
ext_session_lock_surface_v1_destroy(lockSurface); ext_session_lock_surface_v1_destroy(lockSurface);
wl_surface_destroy(surface); wl_surface_destroy(surface);
if (frameCallback) if (frameCallback)
@ -116,7 +119,7 @@ static const wl_callback_listener callbackListener = {
void CSessionLockSurface::render() { void CSessionLockSurface::render() {
Debug::log(TRACE, "render lock"); Debug::log(TRACE, "render lock");
if (frameCallback) if (frameCallback || !readyForFrame)
return; return;
const auto FEEDBACK = g_pRenderer->renderLock(*this); const auto FEEDBACK = g_pRenderer->renderLock(*this);
@ -129,7 +132,6 @@ void CSessionLockSurface::render() {
} }
void CSessionLockSurface::onCallback() { void CSessionLockSurface::onCallback() {
readyForFrame = true;
frameCallback = nullptr; frameCallback = nullptr;
if (needsFrame && !g_pHyprlock->m_bTerminate && g_pEGL) if (needsFrame && !g_pHyprlock->m_bTerminate && g_pEGL)