From f73f1971f970ef9cc5fe35386b1fda49eaf0be82 Mon Sep 17 00:00:00 2001 From: Themaister Date: Sat, 13 Apr 2013 14:35:24 +0200 Subject: [PATCH] Fix threaded driver. Fix case when no poke interface was implemented. --- gfx/sdl_gfx.c | 4 ++++ gfx/thread_wrapper.c | 14 +++++++++++--- gfx/xvideo.c | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gfx/sdl_gfx.c b/gfx/sdl_gfx.c index 71bc81767f..8b76d73944 100644 --- a/gfx/sdl_gfx.c +++ b/gfx/sdl_gfx.c @@ -197,6 +197,10 @@ static void *sdl_gfx_init(const video_info_t *video, const input_driver_t **inpu gfx_set_dwm(); #endif +#ifdef HAVE_X11 + XInitThreads(); +#endif + SDL_InitSubSystem(SDL_INIT_VIDEO); sdl_video_t *vid = (sdl_video_t*)calloc(1, sizeof(*vid)); diff --git a/gfx/thread_wrapper.c b/gfx/thread_wrapper.c index 61f2397c48..3850101053 100644 --- a/gfx/thread_wrapper.c +++ b/gfx/thread_wrapper.c @@ -306,7 +306,9 @@ static void thread_loop(void *data) thr->texture.alpha); thr->texture.frame_updated = false; } - thr->poke->set_texture_enable(thr->driver_data, thr->texture.enable); + + if (thr->poke && thr->poke->set_texture_enable) + thr->poke->set_texture_enable(thr->driver_data, thr->texture.enable); #endif if (thr->apply_state_changes) @@ -688,8 +690,14 @@ static const video_poke_interface_t thread_poke = { static void thread_get_poke_interface(void *data, const video_poke_interface_t **iface) { thread_video_t *thr = (thread_video_t*)data; - *iface = &thread_poke; - thr->driver->poke_interface(thr->driver_data, &thr->poke); + + if (thr->driver->poke_interface) + { + *iface = &thread_poke; + thr->driver->poke_interface(thr->driver_data, &thr->poke); + } + else + *iface = NULL; } #if defined(HAVE_RMENU) || defined(HAVE_RGUI) diff --git a/gfx/xvideo.c b/gfx/xvideo.c index 42c0c6edd7..6bedfe240f 100644 --- a/gfx/xvideo.c +++ b/gfx/xvideo.c @@ -330,6 +330,8 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo if (!xv) return NULL; + XInitThreads(); + xv->display = XOpenDisplay(NULL); struct sigaction sa; unsigned adaptor_count = 0;