diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2023-06-02 23:26:12 +0300 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2023-06-02 23:26:38 +0300 |
commit | 8c0eeb6a86d858a87f4839db4d551817136753c7 (patch) | |
tree | b35d4d78f225a99fd0273ac8bb98ed8e1c4b8cec | |
parent | e75407fd4d9b1cdf95caae3fd8f7c04c751c79a5 (diff) |
session-lock: fix buffer check
If the first commit has no buffer, the unmap hook won't catch it. Check
in the commit hook instead.
-rw-r--r-- | types/wlr_session_lock_v1.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/types/wlr_session_lock_v1.c b/types/wlr_session_lock_v1.c index 431202d6..cd7f6e7a 100644 --- a/types/wlr_session_lock_v1.c +++ b/types/wlr_session_lock_v1.c @@ -134,6 +134,13 @@ static void lock_surface_role_commit(struct wlr_surface *surface) { wlr_session_lock_surface_v1_try_from_wlr_surface(surface); assert(lock_surface != NULL); + if (!wlr_surface_has_buffer(surface)) { + wl_resource_post_error(lock_surface->resource, + EXT_SESSION_LOCK_SURFACE_V1_ERROR_NULL_BUFFER, + "session lock surface is committed with a null buffer"); + return; + } + if (!lock_surface->configured) { wl_resource_post_error(lock_surface->resource, EXT_SESSION_LOCK_SURFACE_V1_ERROR_COMMIT_BEFORE_FIRST_ACK, @@ -155,16 +162,6 @@ static void lock_surface_role_commit(struct wlr_surface *surface) { wlr_surface_map(surface); } -static void lock_surface_role_unmap(struct wlr_surface *surface) { - struct wlr_session_lock_surface_v1 *lock_surface = - wlr_session_lock_surface_v1_try_from_wlr_surface(surface); - assert(lock_surface != NULL); - - wl_resource_post_error(lock_surface->resource, - EXT_SESSION_LOCK_SURFACE_V1_ERROR_NULL_BUFFER, - "session lock surfaces committed with null buffer"); -} - static void lock_surface_role_destroy(struct wlr_surface *surface) { struct wlr_session_lock_surface_v1 *lock_surface = wlr_session_lock_surface_v1_try_from_wlr_surface(surface); @@ -191,7 +188,6 @@ static void lock_surface_role_destroy(struct wlr_surface *surface) { static const struct wlr_surface_role lock_surface_role = { .name = "ext_session_lock_surface_v1", .commit = lock_surface_role_commit, - .unmap = lock_surface_role_unmap, .destroy = lock_surface_role_destroy, }; |