History

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.

nanahi committed 2 years ago

Commit ee2e1401 parent cb613ba1 file · +3 −2Browse files

Unified · Split

video/out/w32_common.c+3−2
@@ -2031,6 +2031,7 @@ static MP_THREAD_VOID gui_thread(void *ptr) · 2030 unmodified lines
20312031 goto done;
20322032 }
20332033
2034+ w32->menu_ctx = mp_win32_menu_init();
20342035 update_dark_mode(w32);
20352036 update_corners_pref(w32);
20362037 if (w32->opts->window_affinity)
@@ -2106,6 +2107,8 @@ done: · 69 unmodified lines
21062107 MP_VERBOSE(w32, "uninit\n");
21072108
21082109 remove_parent_hook(w32);
2110+ if (w32->menu_ctx)
2111+ mp_win32_menu_uninit(w32->menu_ctx);
21092112 if (w32->window && !w32->destroyed)
21102113 DestroyWindow(w32->window);
21112114 if (w32->taskbar_list)
@@ -2131,7 +2134,6 @@ bool vo_w32_init(struct vo *vo) · 19 unmodified lines
21312134 .dispatch = mp_dispatch_create(w32),
21322135 };
21332136 w32->opts = w32->opts_cache->opts;
2134− w32->menu_ctx = mp_win32_menu_init();
21352137 vo->w32 = w32;
21362138
21372139 if (mp_thread_create(&w32->thread, gui_thread, w32))
@@ -2422,7 +2424,6 @@ void vo_w32_uninit(struct vo *vo) · 284 unmodified lines
24222424
24232425 AvRevertMmThreadCharacteristics(w32->avrt_handle);
24242426
2425− mp_win32_menu_uninit(w32->menu_ctx);
24262427 talloc_free(w32);
24272428 vo->w32 = NULL;
24282429 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t