mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-18 01:08:16 +00:00
Revert "Removing a timer that isn't running is a success."
This reverts commit 795499a529
.
This breaks compatibility with SDL2 and there isn't a compelling reason to make this change.
This commit is contained in:
@@ -353,6 +353,7 @@ int SDL_RemoveTimer(SDL_TimerID id)
|
||||
{
|
||||
SDL_TimerData *data = &SDL_timer_data;
|
||||
SDL_TimerMap *prev, *entry;
|
||||
SDL_bool canceled = SDL_FALSE;
|
||||
|
||||
if (!id) {
|
||||
return SDL_InvalidParamError("id");
|
||||
@@ -376,10 +377,15 @@ int SDL_RemoveTimer(SDL_TimerID id)
|
||||
if (entry) {
|
||||
if (!SDL_AtomicGet(&entry->timer->canceled)) {
|
||||
SDL_AtomicSet(&entry->timer->canceled, 1);
|
||||
canceled = SDL_TRUE;
|
||||
}
|
||||
SDL_free(entry);
|
||||
}
|
||||
return 0;
|
||||
if (canceled) {
|
||||
return 0;
|
||||
} else {
|
||||
return SDL_SetError("Timer not found");
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
Reference in New Issue
Block a user