<html><head></head><body>Hi,<br><br>It is never NULL at the moment. But whether it can reasonably be NULL... I'd say it can if all resources were tracked by objres. So IMO, it's *not* a case for an assertion.<br><br><div class="gmail_quote">Le 18 juillet 2019 08:51:08 GMT+03:00, Thomas Guillem <thomas@gllm.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><br><br>On Wed, Jul 17, 2019, at 22:26, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><hr> include/vlc_opengl.h | 1 +<br> modules/video_output/glx.c | 3 ++-<br> modules/video_output/opengl/egl.c | 5 +++--<br> modules/video_output/vgl.c | 5 +++--<br> modules/video_output/win32/wgl.c | 3 ++-<br> src/video_output/opengl.c | 11 ++---------<br> 6 files changed, 13 insertions(+), 15 deletions(-)<br><br>diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h<br>index 8c4909fc5d..4e436c939b 100644<br>--- a/include/vlc_opengl.h<br>+++ b/include/vlc_opengl.h<br>@@ -51,6 +51,7 @@ struct vlc_gl_t<br> void (*resize)(vlc_gl_t *, unsigned, unsigned);<br> void (*swap)(vlc_gl_t *);<br> void*(*getProcAddress)(vlc_gl_t *, const char *);<br>+ void (*destroy)(vlc_gl_t *);<br> <br> enum {<br> VLC_GL_EXT_DEFAULT,<br>diff --git a/modules/video_output/glx.c b/modules/video_output/glx.c<br>index d5d47c017a..9856c063a3 100644<br>--- a/modules/video_output/glx.c<br>+++ b/modules/video_output/glx.c<br>@@ -219,6 +219,7 @@ static int Open(vlc_gl_t *gl, unsigned width, <br>unsigned height)<br> gl->resize = NULL;<br> gl->swap = SwapBuffers;<br> gl->getProcAddress = GetSymbol;<br>+ gl->destroy = Close;<br> <br> bool is_swap_interval_set = false;<br> <br>@@ -271,5 +272,5 @@ vlc_module_begin ()<br> set_category (CAT_VIDEO)<br> set_subcategory (SUBCAT_VIDEO_VOUT)<br> set_capability ("opengl", 20)<br>- set_callbacks (Open, Close)<br>+ set_callbacks(Open, NULL)<br> vlc_module_end ()<br>diff --git a/modules/video_output/opengl/egl.c <br>b/modules/video_output/opengl/egl.c<br>index bd1b6941e4..b34ac06114 100644<br>--- a/modules/video_output/opengl/egl.c<br>+++ b/modules/video_output/opengl/egl.c<br>@@ -381,6 +381,7 @@ static int Open(vlc_gl_t *gl, const struct gl_api <br>*api,<br> gl->resize = Resize;<br> gl->swap = SwapBuffers;<br> gl->getProcAddress = GetSymbol;<br>+ gl->destroy = Close;<br> gl->egl.queryString = QueryString;<br> <br> sys->eglCreateImageKHR = (void *)eglGetProcAddress("eglCreateImageKHR");<br>@@ -422,12 +423,12 @@ vlc_module_begin ()<br> set_category (CAT_VIDEO)<br> set_subcategory (SUBCAT_VIDEO_VOUT)<br> set_capability ("opengl", 50)<br>- set_callbacks (OpenGL, Close)<br>+ set_callbacks(OpenGL, NULL)<br> add_shortcut ("egl")<br> <br> add_submodule ()<br> set_capability ("opengl es2", 50)<br>- set_callbacks (OpenGLES2, Close)<br>+ set_callbacks(OpenGLES2, NULL)<br> add_shortcut ("egl")<br> <br> vlc_module_end ()<br>diff --git a/modules/video_output/vgl.c b/modules/video_output/vgl.c<br>index c2c9be3696..e6825e19ac 100644<br>--- a/modules/video_output/vgl.c<br>+++ b/modules/video_output/vgl.c<br>@@ -129,6 +129,7 @@ static int Open(vlc_gl_t *gl, unsigned width, <br>unsigned height)<br> gl->resize = Resize;<br> gl->swap = VglSwapBuffers;<br> gl->getProcAddress = OurGetProcAddress;<br>+ gl->destroy = Close;<br> <br> if( sys->setupCb )<br> if( !sys->setupCb(sys->opaque) )<br>@@ -154,11 +155,11 @@ vlc_module_begin()<br> set_subcategory(SUBCAT_VIDEO_VOUT)<br> <br> set_capability("opengl", 0)<br>- set_callbacks(Open, Close)<br>+ set_callbacks(Open, NULL)<br> add_shortcut("vglmem")<br> <br> add_submodule()<br> set_capability("opengl es2", 0)<br>- set_callbacks(Open, Close)<br>+ set_callbacks(Open, NULL)<br> add_shortcut("vglmem")<br> vlc_module_end()<br>diff --git a/modules/video_output/win32/wgl.c <br>b/modules/video_output/win32/wgl.c<br>index 8f18424a8b..149149963f 100644<br>--- a/modules/video_output/win32/wgl.c<br>+++ b/modules/video_output/win32/wgl.c<br>@@ -49,7 +49,7 @@ vlc_module_begin()<br> add_integer("gpu-affinity", -1, HW_GPU_AFFINITY_TEXT, <br>HW_GPU_AFFINITY_TEXT, true)<br> <br> set_capability("opengl", 50)<br>- set_callbacks(Open, Close)<br>+ set_callbacks(Open, NULL)<br> add_shortcut("wgl")<br> vlc_module_end()<br> <br>@@ -235,6 +235,7 @@ static int Open(vlc_gl_t *gl, unsigned width, <br>unsigned height)<br> gl->resize = NULL;<br> gl->swap = Swap;<br> gl->getProcAddress = OurGetProcAddress;<br>+ gl->destroy = Close;<br> <br> if (sys->exts.GetExtensionsStringEXT || sys->exts.GetExtensionsStringARB)<br> gl->wgl.getExtensionsString = GetExtensionsString;<br>diff --git a/src/video_output/opengl.c b/src/video_output/opengl.c<br>index f17c8ff05c..9d207ac709 100644<br>--- a/src/video_output/opengl.c<br>+++ b/src/video_output/opengl.c<br>@@ -52,14 +52,6 @@ static int vlc_gl_start(void *func, bool forced, va_list ap)<br> return ret;<br> }<br> <br>-static void vlc_gl_stop(void *func, va_list ap)<br>-{<br>- void (*deactivate)(vlc_gl_t *) = func;<br>- vlc_gl_t *gl = va_arg(ap, vlc_gl_t *);<br>-<br>- deactivate(gl);<br>-}<br>-<br> vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *restrict cfg,<br> unsigned flags, const char *name)<br> {<br>@@ -111,7 +103,8 @@ void vlc_gl_Release(vlc_gl_t *gl)<br> if (!vlc_atomic_rc_dec(&glpriv->rc))<br> return;<br> <br>- vlc_module_unload(gl->module, vlc_gl_stop, gl);<br>+ if (gl->destroy != NULL)<br>+ gl->destroy(gl);<br></blockquote><br>Can gl->destroy be NULL ? If not, I would have put an assert(gl->destroy)<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> vlc_objres_clear(VLC_OBJECT(gl));<br> vlc_object_delete(gl);<br> }<br>-- <br>2.22.0<hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>