aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/x11.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/x11.c b/src/x11.c
index 5dc92e5..4377f77 100644
--- a/src/x11.c
+++ b/src/x11.c
@@ -1409,16 +1409,14 @@ puglStopTimer(PuglView* const view, const uintptr_t id)
if (w->timers[i].view == view && w->timers[i].id == id) {
XSyncDestroyAlarm(w->display, w->timers[i].alarm);
- if (i == w->numTimers - 1) {
- memset(&w->timers[i], 0, sizeof(PuglTimer));
- } else {
+ if (i != w->numTimers - 1) {
memmove(w->timers + i,
w->timers + i + 1,
sizeof(PuglTimer) * (w->numTimers - i - 1));
-
- memset(&w->timers[i], 0, sizeof(PuglTimer));
}
+ memset(&w->timers[w->numTimers - 1], 0, sizeof(PuglTimer));
+
--w->numTimers;
return PUGL_SUCCESS;
}