[gens-sdl] CrazyEffectLoop: Stop SDL video when exiting the event loop.
authorDavid Korth <gerbilsoft@gerbilsoft.com>
Thu, 3 Sep 2015 04:45:52 +0000 (00:45 -0400)
committerDavid Korth <gerbilsoft@gerbilsoft.com>
Thu, 3 Sep 2015 04:45:52 +0000 (00:45 -0400)
FIXME: We're not using audio here, so maybe deleting sdlHandler won't crash?

src/gens-sdl/CrazyEffectLoop.cpp

index 6fdf8a0..3232dce 100644 (file)
@@ -191,6 +191,14 @@ int CrazyEffectLoop::run(const char *rom_filename)
        delete d->crazyEffect;
        d->crazyEffect = nullptr;
 
+       // NOTE: Deleting sdlHandler can cause crashes on Windows
+       // due to the timer callback trying to post the semaphore
+       // after it's been deleted.
+       // Shut down the SDL functions manually.
+       // FIXME: We're not using audio here, so maybe it won't crash?
+       d->sdlHandler->end_video();
+       d->vBackend = nullptr;
+
        // Done running the "Crazy" Effect loop.
        return 0;
 }