[vlc-devel] [PATCH 3/3] win32: window: re-create the window if it was destroyed externally
Thomas Guillem
thomas at gllm.fr
Mon May 6 12:07:08 CEST 2019
This fixes dysfunctional vout when the user destroyed manually the window and
started a new video. The enable() callback need to check if the current window
is valid and re-create it if not.
---
modules/video_output/win32/window.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/modules/video_output/win32/window.c b/modules/video_output/win32/window.c
index 87d8612d0c..c0d05b2182 100644
--- a/modules/video_output/win32/window.c
+++ b/modules/video_output/win32/window.c
@@ -146,6 +146,20 @@ static int Enable(vout_window_t *wnd, const vout_window_cfg_t *cfg)
{
vout_window_sys_t *sys = wnd->sys;
+ vlc_mutex_lock( &sys->lock );
+ assert( sys->hwnd );
+ if( sys->b_done )
+ {
+ /* The window was destroyed externally, re-create it */
+ DestroyWindowThreadLocked( wnd );
+ if( CreateWindowThreadLocked( wnd ) )
+ {
+ vlc_mutex_unlock( &sys->lock );
+ return VLC_EGENERIC;
+ }
+ }
+ vlc_mutex_unlock( &sys->lock );
+
LONG i_window_style;
if (cfg->is_decorated)
i_window_style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
--
2.20.1
More information about the vlc-devel
mailing list