From 9b7ce457a5c72f36c15c7bf01e83d18b5f75be44 Mon Sep 17 00:00:00 2001 From: LunaDL <91587464+EnzoDLofi@users.noreply.github.com> Date: Sun, 29 Nov 2026 01:51:24 -0400 Subject: [PATCH] Keep current buffer attached when hide callback allocation fails --- app/src/main/cpp/waylandcomp/src/sc_layer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/cpp/waylandcomp/src/sc_layer.c b/app/src/main/cpp/waylandcomp/src/sc_layer.c index 546ea82f40..018664f9c3 100644 --- a/app/src/main/cpp/waylandcomp/src/sc_layer.c +++ b/app/src/main/cpp/waylandcomp/src/sc_layer.c @@ -1232,13 +1232,11 @@ static int hide_layer(struct layer *l) { if (!l->sc || !l->shown || api.state != 1) return 0; ASurfaceTransaction *tx = api.txCreate(); if (!tx) return -1; - replace_with_blank(tx, l); api.setVisibility(tx, l->sc, ASC_VISIBILITY_HIDE); if (add_complete(tx, l, l->cur_slot, l->cur_token, 0) != 0) { /* - * Hiding does not require a release callback. Apply the visibility - * change now, but keep the current slot/token pinned until a later - * presentation or retirement can attach a completion callback. + * Keep the current buffer attached when its release callback cannot + * be allocated. The hide can still apply without releasing the slot. */ api.txApply(tx); api.txDelete(tx); @@ -1246,6 +1244,7 @@ static int hide_layer(struct layer *l) { droiddeck_log("layer", "%s: hidden; buffer release deferred because its callback could not be allocated", l->name); return 0; } + replace_with_blank(tx, l); api.txApply(tx); api.txDelete(tx); l->shown = 0; l->cur_slot = -1; l->cur_token = NULL; return 0;