mirror of https://github.com/mgba-emu/mgba.git
Make SDL port QUIT events thread-safe
This commit is contained in:
parent
d48dad27d1
commit
c9f74b43af
|
@ -248,14 +248,7 @@ static void _GBASDLHandleWindowEvent(struct GBAThread* context, struct GBASDLEve
|
||||||
void GBASDLHandleEvent(struct GBAThread* context, struct GBASDLEvents* sdlContext, const union SDL_Event* event) {
|
void GBASDLHandleEvent(struct GBAThread* context, struct GBASDLEvents* sdlContext, const union SDL_Event* event) {
|
||||||
switch (event->type) {
|
switch (event->type) {
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
// FIXME: this isn't thread-safe
|
GBAThreadEnd(context);
|
||||||
if (context->debugger) {
|
|
||||||
context->debugger->state = DEBUGGER_EXITING;
|
|
||||||
}
|
|
||||||
MutexLock(&context->stateMutex);
|
|
||||||
context->state = THREAD_EXITING;
|
|
||||||
ConditionWake(&context->stateCond);
|
|
||||||
MutexUnlock(&context->stateMutex);
|
|
||||||
break;
|
break;
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
|
|
Loading…
Reference in New Issue