summaryrefslogtreecommitdiff
path: root/src/common/loop.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-12 13:36:04 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-12 13:37:25 +0300
commitaedd863e6f66fd446227e9b107bc9c1970092634 (patch)
tree27836fd18bfbe09ee7c8f9fa8cc14308b9f04fa9 /src/common/loop.c
parentb20263cf9b6d85c7e5919497b5d36b4c81463b15 (diff)
timers: drop retired surface timer ids
yasl_surface_del_timer zeroed its entry and kept it. A one-shot surface timer that fired stayed in the surface's id list until the surface was destroyed. A client that re-arms a one-shot timer, such as a cursor blink, grew the list without bound, and each delete scanned all of it. Delete now removes the entry. Before the list grows, add drops the ids that the loop has retired. The list holds only armed timers. Delete now returns false for a timer that already retired, as yasl_loop_del_timer does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/common/loop.c')
-rw-r--r--src/common/loop.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/loop.c b/src/common/loop.c
index 3815e91..a63df16 100644
--- a/src/common/loop.c
+++ b/src/common/loop.c
@@ -208,6 +208,15 @@ static void timer_cleanup_deleted(struct yasl_loop *l)
l->timer_count = dest;
}
+bool yasl_loop_timer_armed(const struct yasl_loop *l, yasl_timer_id id)
+{
+ if (!l || id == 0) return false;
+ for (int i = 0; i < l->timer_count; i++)
+ if (l->timers[i].id == id)
+ return !l->timers[i].deleted;
+ return false;
+}
+
int yasl_loop_next_timeout_ms(const struct yasl_loop *l)
{
if (!l || l->timer_count <= 0) return -1;