fix crash on exit

This commit is contained in:
Anthony Pesch 2017-05-20 16:59:01 -04:00
parent ece8279cc0
commit 11c89443e6
3 changed files with 12 additions and 10 deletions

View File

@ -107,19 +107,20 @@ static void *emu_video_thread(void *data) {
/* make secondary context active for this thread */
r_make_current(emu->r2);
while (emu->running) {
while (1) {
mutex_lock(emu->pending_mutex);
/* wait for the next tile context provided by emu_start_render */
while (!emu->pending_ctx) {
/* check for shutdown */
if (!emu->running) {
break;
}
cond_wait(emu->pending_cond, emu->pending_mutex);
}
/* check for shutdown */
if (!emu->running) {
mutex_unlock(emu->pending_mutex);
break;
}
/* parse the context, uploading its textures to the render backend */
tr_parse_context(emu->tr, emu->pending_ctx, &emu->video_ctx);
emu->pending_ctx = NULL;
@ -325,6 +326,7 @@ static void emu_video_context_destroyed(void *userdata) {
/* destroy the video thread */
if (emu->multi_threaded) {
mutex_lock(emu->pending_mutex);
emu->pending_ctx = (struct tile_ctx *)0xdeadbeef;
cond_signal(emu->pending_cond);
mutex_unlock(emu->pending_mutex);

View File

@ -231,7 +231,7 @@ static void ta_soft_reset(struct ta *ta) {
}
static void ta_clear_textures(struct ta *ta) {
LOG_INFO("Texture cache cleared");
LOG_INFO("ta_clear_textures");
struct rb_node *it = rb_first(&ta->live_entries);

View File

@ -547,7 +547,7 @@ static void input_handle_controller_removed(struct sdl_host *host, int port) {
return;
}
LOG_INFO("controller %s removed from port %d", SDL_GameControllerName(ctrl),
LOG_INFO("controller '%s' removed from port %d", SDL_GameControllerName(ctrl),
port);
SDL_GameControllerClose(ctrl);
host->controllers[port] = NULL;
@ -563,14 +563,14 @@ static void input_handle_controller_added(struct sdl_host *host,
}
}
if (port >= INPUT_MAX_CONTROLLERS) {
LOG_WARNING("No open ports to bind controller to");
LOG_WARNING("no open ports to bind controller to");
return;
}
SDL_GameController *ctrl = SDL_GameControllerOpen(device_id);
host->controllers[port] = ctrl;
LOG_INFO("controller %s added on port %d", SDL_GameControllerName(ctrl),
LOG_INFO("controller '%s' added on port %d", SDL_GameControllerName(ctrl),
port);
}