From 1b81620d6497e51741614578d399fb4c1e0f5dd2 Mon Sep 17 00:00:00 2001 From: Jamiras Date: Fri, 5 Mar 2021 22:22:31 -0700 Subject: [PATCH] ensure rewint is only initialized/deinitialized on main thread --- cheevos/cheevos.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index a06309da7b..95f51930ee 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -1584,7 +1584,14 @@ static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals) /* deinit rewind */ if (rewind_enable) + { +#ifdef HAVE_THREADS + /* have to "schedule" this. CMD_EVENT_REWIND_DEINIT should only be called on the main thread */ + rcheevos_locals.queued_command = CMD_EVENT_REWIND_DEINIT; +#else command_event(CMD_EVENT_REWIND_DEINIT, NULL); +#endif + } } else { @@ -1601,7 +1608,14 @@ static void rcheevos_toggle_hardcore_active(rcheevos_locals_t* locals) /* re-init rewind */ if (rewind_enable) + { +#ifdef HAVE_THREADS + /* have to "schedule" this. CMD_EVENT_REWIND_INIT should only be called on the main thread */ + rcheevos_locals.queued_command = CMD_EVENT_REWIND_INIT; +#else command_event(CMD_EVENT_REWIND_INIT, NULL); +#endif + } } if (locals->loaded)