win-capture: Destroy winrt in graphics thread

master
jp9000 2020-03-14 10:40:42 -07:00
parent 934a18625e
commit 6209bea371
1 changed files with 21 additions and 14 deletions

View File

@ -210,11 +210,14 @@ static void *wc_create(obs_data_t *settings, obs_source_t *source)
return wc; return wc;
} }
static void wc_destroy(void *data) static void wc_actual_destroy(void *data)
{ {
struct window_capture *wc = data; struct window_capture *wc = data;
if (wc) { if (wc->capture_winrt) {
wc->exports.winrt_capture_free(wc->capture_winrt);
}
obs_enter_graphics(); obs_enter_graphics();
dc_capture_free(&wc->capture); dc_capture_free(&wc->capture);
obs_leave_graphics(); obs_leave_graphics();
@ -227,7 +230,11 @@ static void wc_destroy(void *data)
os_dlclose(wc->winrt_module); os_dlclose(wc->winrt_module);
bfree(wc); bfree(wc);
} }
static void wc_destroy(void *data)
{
obs_queue_task(OBS_TASK_GRAPHICS, wc_actual_destroy, data, false);
} }
static void wc_update(void *data, obs_data_t *settings) static void wc_update(void *data, obs_data_t *settings)