From af5a651f77fc980329da23257d1ffeff5f74171e Mon Sep 17 00:00:00 2001 From: Nilesh Date: Thu, 9 Apr 2026 17:34:06 -0700 Subject: [PATCH] fix: handle EGL surface creation failure gracefully instead of aborting When GPU VRAM is exhausted, eglCreatePlatformWindowSurfaceEXT and wl_egl_window_create can return null. Previously this triggered RASSERT -> std::abort(), crashing hyprlock and leaving the session in a broken lock state. Replace RASSERT with error logging and early return, setting readyForFrame = false so the next configure event retries the allocation. This allows hyprlock to survive transient GPU memory pressure rather than crashing. Fixes: https://github.com/hyprwm/hyprlock/issues/986 --- src/core/LockSurface.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/LockSurface.cpp b/src/core/LockSurface.cpp index 2bdec49..e43f2bd 100644 --- a/src/core/LockSurface.cpp +++ b/src/core/LockSurface.cpp @@ -84,13 +84,21 @@ void CSessionLockSurface::configure(const Vector2D& size_, uint32_t serial_) { if (!eglWindow) { eglWindow = wl_egl_window_create((wl_surface*)surface->resource(), size.x, size.y); - RASSERT(eglWindow, "Couldn't create eglWindow"); + if (!eglWindow) { + Debug::log(ERR, "Couldn't create eglWindow (GPU memory pressure?), will retry on next configure"); + readyForFrame = false; + return; + } } else wl_egl_window_resize(eglWindow, size.x, size.y, 0, 0); if (!eglSurface) { eglSurface = g_pEGL->eglCreatePlatformWindowSurfaceEXT(g_pEGL->eglDisplay, g_pEGL->eglConfig, eglWindow, nullptr); - RASSERT(eglSurface, "Couldn't create eglSurface"); + if (!eglSurface) { + Debug::log(ERR, "Couldn't create eglSurface (GPU memory pressure?), will retry on next configure"); + readyForFrame = false; + return; + } } if (readyForFrame && !(SAMESIZE && SAMESCALE)) {