[vlc-commits] kva: refuse to create the module if the parent window is invalid

Steve Lhomme git at videolan.org
Mon Nov 2 16:29:25 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Nov  2 14:56:53 2020 +0100| [d27f2c7cd2f2dfa6052f799d8637b243c944b65a] | committer: Steve Lhomme

kva: refuse to create the module if the parent window is invalid

When fixt23 is set we're not using the parent window at all.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d27f2c7cd2f2dfa6052f799d8637b243c944b65a
---

 modules/video_output/kva.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index c9546cce4d..b269f9ab93 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -96,7 +96,6 @@ struct vout_display_sys_t
     bool               b_fixt23;
     PFNWP              p_old_frame;
     RECTL              client_rect;
-    vout_window_t     *parent_window;
     HWND               parent;
     unsigned           button_pressed;
     bool               is_mouse_hidden;
@@ -187,15 +186,10 @@ static void PMThread( void *arg )
                       CS_SIZEREDRAW | CS_MOVENOTIFY,
                       sizeof( PVOID ));
 
-    sys->b_fixt23 = var_CreateGetBool( vd, "kva-fixt23");
-
-    if( !sys->b_fixt23 && vd->cfg->window->type == VOUT_WINDOW_TYPE_HWND )
-        /* If an external window was specified, we'll draw in it. */
-        sys->parent_window = vd->cfg->window;
-
     if( !sys->b_fixt23 )
     {
-        sys->parent = ( HWND )sys->parent_window->handle.hwnd;
+        /* If an external window was specified, we'll draw in it. */
+        sys->parent = ( HWND )vd->cfg->window->handle.hwnd;
 
         ULONG i_style = WinQueryWindowULong( sys->parent, QWL_STYLE );
         WinSetWindowULong( sys->parent, QWL_STYLE,
@@ -336,6 +330,14 @@ static int Open ( vout_display_t *vd, const vout_display_cfg_t *cfg,
     if( !sys )
         return VLC_ENOMEM;
 
+    sys->b_fixt23 = var_CreateGetBool( vd, "kva-fixt23");
+
+    if( !sys->b_fixt23 && cfg->window->type != VOUT_WINDOW_TYPE_HWND )
+    {
+        free( sys );
+        return VLC_EBADVAR;
+    }
+
     DosCreateEventSem( NULL, &sys->ack_event, 0, FALSE );
 
     sys->tid = _beginthread( PMThread, NULL, 1024 * 1024, &init );



More information about the vlc-commits mailing list