mirror of https://github.com/inolen/redream.git
fix crash on exit
This commit is contained in:
parent
ece8279cc0
commit
11c89443e6
|
@ -107,19 +107,20 @@ static void *emu_video_thread(void *data) {
|
||||||
/* make secondary context active for this thread */
|
/* make secondary context active for this thread */
|
||||||
r_make_current(emu->r2);
|
r_make_current(emu->r2);
|
||||||
|
|
||||||
while (emu->running) {
|
while (1) {
|
||||||
mutex_lock(emu->pending_mutex);
|
mutex_lock(emu->pending_mutex);
|
||||||
|
|
||||||
/* wait for the next tile context provided by emu_start_render */
|
/* wait for the next tile context provided by emu_start_render */
|
||||||
while (!emu->pending_ctx) {
|
while (!emu->pending_ctx) {
|
||||||
/* check for shutdown */
|
|
||||||
if (!emu->running) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
cond_wait(emu->pending_cond, emu->pending_mutex);
|
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 */
|
/* parse the context, uploading its textures to the render backend */
|
||||||
tr_parse_context(emu->tr, emu->pending_ctx, &emu->video_ctx);
|
tr_parse_context(emu->tr, emu->pending_ctx, &emu->video_ctx);
|
||||||
emu->pending_ctx = NULL;
|
emu->pending_ctx = NULL;
|
||||||
|
@ -325,6 +326,7 @@ static void emu_video_context_destroyed(void *userdata) {
|
||||||
/* destroy the video thread */
|
/* destroy the video thread */
|
||||||
if (emu->multi_threaded) {
|
if (emu->multi_threaded) {
|
||||||
mutex_lock(emu->pending_mutex);
|
mutex_lock(emu->pending_mutex);
|
||||||
|
emu->pending_ctx = (struct tile_ctx *)0xdeadbeef;
|
||||||
cond_signal(emu->pending_cond);
|
cond_signal(emu->pending_cond);
|
||||||
mutex_unlock(emu->pending_mutex);
|
mutex_unlock(emu->pending_mutex);
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ static void ta_soft_reset(struct ta *ta) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ta_clear_textures(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);
|
struct rb_node *it = rb_first(&ta->live_entries);
|
||||||
|
|
||||||
|
|
|
@ -547,7 +547,7 @@ static void input_handle_controller_removed(struct sdl_host *host, int port) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("controller %s removed from port %d", SDL_GameControllerName(ctrl),
|
LOG_INFO("controller '%s' removed from port %d", SDL_GameControllerName(ctrl),
|
||||||
port);
|
port);
|
||||||
SDL_GameControllerClose(ctrl);
|
SDL_GameControllerClose(ctrl);
|
||||||
host->controllers[port] = NULL;
|
host->controllers[port] = NULL;
|
||||||
|
@ -563,14 +563,14 @@ static void input_handle_controller_added(struct sdl_host *host,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (port >= INPUT_MAX_CONTROLLERS) {
|
if (port >= INPUT_MAX_CONTROLLERS) {
|
||||||
LOG_WARNING("No open ports to bind controller to");
|
LOG_WARNING("no open ports to bind controller to");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_GameController *ctrl = SDL_GameControllerOpen(device_id);
|
SDL_GameController *ctrl = SDL_GameControllerOpen(device_id);
|
||||||
host->controllers[port] = ctrl;
|
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);
|
port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue