[vlc-commits] vout/win32: fix vlc_gl_t creation

Filip Roséen git at videolan.org
Mon Dec 19 15:04:08 CET 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Mon Dec 19 03:20:28 2016 +0100| [87448d600c51f9da2b1def9929405d01bafebc66] | committer: Thomas Guillem

vout/win32: fix vlc_gl_t creation

These changes makes us of vlc_gl_Create to create an object of type
vlc_gl_t, effectively making sure that it is a valid VLC_OBJECT
(instead of only looking like such).

refs #17795

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/video_output/win32/common.h  |  2 +-
 modules/video_output/win32/glwin32.c | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index ee3d326..e88184d 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -161,7 +161,7 @@ struct vout_display_sys_t
 #if defined(MODULE_NAME_IS_glwin32) || defined(MODULE_NAME_IS_wgl)
     HDC                   hGLDC;
     HGLRC                 hGLRC;
-    vlc_gl_t              gl;
+    vlc_gl_t              *gl;
 # ifdef MODULE_NAME_IS_glwin32
     vout_display_opengl_t *vgl;
 # endif
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index 8dace96..c8e2429 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -215,13 +215,18 @@ static int Open(vlc_object_t *object)
 #endif
 
     /* */
-    sys->gl.swap = Swap;
-    sys->gl.getProcAddress = OurGetProcAddress;
-    sys->gl.sys = vd;
+    sys->gl = vlc_gl_Create(object);
+
+    if (unlikely(!sys->gl))
+        goto error;
+
+    sys->gl->swap = Swap;
+    sys->gl->getProcAddress = OurGetProcAddress;
+    sys->gl->sys = vd;
 
     video_format_t fmt = vd->fmt;
     const vlc_fourcc_t *subpicture_chromas;
-    sys->vgl = vout_display_opengl_New(&fmt, &subpicture_chromas, &sys->gl,
+    sys->vgl = vout_display_opengl_New(&fmt, &subpicture_chromas, sys->gl,
                                        &vd->cfg->viewpoint);
     if (!sys->vgl)
         goto error;
@@ -259,6 +264,9 @@ static void Close(vlc_object_t *object)
     if (sys->vgl)
         vout_display_opengl_Delete(sys->vgl);
 
+    if (sys->gl)
+        vlc_gl_Destroy(sys->gl);
+
     if (sys->hGLDC && sys->hGLRC)
         wglMakeCurrent(NULL, NULL);
     if (sys->hGLRC)



More information about the vlc-commits mailing list