mirror of https://github.com/mpv-player/mpv
win32: move context menu init/uninit to GUI thread
Currently if VO init fails, the context menu is leaked. Additionally, init/uninit are in the VO thread, while other accesses are in the GUI thread. Fix this by moving them to the GUI thread, similar to other resources. This also lets init function take the mpv HWND in the next commit.
This commit is contained in:
parent
cb613ba916
commit
ee2e14015d
|
@ -2031,6 +2031,7 @@ static MP_THREAD_VOID gui_thread(void *ptr)
|
|||
goto done;
|
||||
}
|
||||
|
||||
w32->menu_ctx = mp_win32_menu_init();
|
||||
update_dark_mode(w32);
|
||||
update_corners_pref(w32);
|
||||
if (w32->opts->window_affinity)
|
||||
|
@ -2106,6 +2107,8 @@ done:
|
|||
MP_VERBOSE(w32, "uninit\n");
|
||||
|
||||
remove_parent_hook(w32);
|
||||
if (w32->menu_ctx)
|
||||
mp_win32_menu_uninit(w32->menu_ctx);
|
||||
if (w32->window && !w32->destroyed)
|
||||
DestroyWindow(w32->window);
|
||||
if (w32->taskbar_list)
|
||||
|
@ -2131,7 +2134,6 @@ bool vo_w32_init(struct vo *vo)
|
|||
.dispatch = mp_dispatch_create(w32),
|
||||
};
|
||||
w32->opts = w32->opts_cache->opts;
|
||||
w32->menu_ctx = mp_win32_menu_init();
|
||||
vo->w32 = w32;
|
||||
|
||||
if (mp_thread_create(&w32->thread, gui_thread, w32))
|
||||
|
@ -2422,7 +2424,6 @@ void vo_w32_uninit(struct vo *vo)
|
|||
|
||||
AvRevertMmThreadCharacteristics(w32->avrt_handle);
|
||||
|
||||
mp_win32_menu_uninit(w32->menu_ctx);
|
||||
talloc_free(w32);
|
||||
vo->w32 = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue