diff options
author | Thomas Brand <tom@trellis.ch> | 2023-03-25 02:20:57 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-05-22 13:10:54 -0400 |
commit | 6b31fb5a4bfd634f5af6ee30e637d81101d1d62b (patch) | |
tree | ff61bbad0926f395da8ba6c9f75c4dc0d713920e /src | |
parent | b3f68b0c17edb686749ad2e595476ed971af01e3 (diff) | |
download | pugl-6b31fb5a4bfd634f5af6ee30e637d81101d1d62b.tar.gz pugl-6b31fb5a4bfd634f5af6ee30e637d81101d1d62b.tar.bz2 pugl-6b31fb5a4bfd634f5af6ee30e637d81101d1d62b.zip |
X11: Fix puglStopTimer() with multiple timers
Diffstat (limited to 'src')
-rw-r--r-- | src/x11.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -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; } |