[vlc-commits] Revert "dialog: change dialog_provider init/deinit functions"

Rémi Denis-Courmont git at videolan.org
Fri Feb 19 01:11:31 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Feb 19 02:10:40 2016 +0200| [696aa6ff1a1a88f456e788fda6f1eea6af5b80ad] | committer: Rémi Denis-Courmont

Revert "dialog: change dialog_provider init/deinit functions"

This reverts commit f36f415200f9dc793808eca05a09076d319daaae.

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

 include/vlc_dialog.h   |    6 +++---
 src/interface/dialog.c |   18 +++++++-----------
 src/libvlc.c           |    5 +++--
 3 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/include/vlc_dialog.h b/include/vlc_dialog.h
index 66e5229..786da22 100644
--- a/include/vlc_dialog.h
+++ b/include/vlc_dialog.h
@@ -28,12 +28,12 @@ typedef struct vlc_dialog_id vlc_dialog_id;
 typedef struct extension_dialog_t extension_dialog_t;
 
 /* Called from src/libvlc.c */
-int
-libvlc_dialog_provider_init(libvlc_int_t *p_libvlc);
+vlc_dialog_provider *
+vlc_dialog_provider_new(void);
 
 /* Called from src/libvlc.c */
 void
-libvlc_dialog_provider_deinit(libvlc_int_t *p_libvlc);
+vlc_dialog_provider_release(vlc_dialog_provider *p_provider);
 
 /**
  * @defgroup vlc_dialog VLC dialog
diff --git a/src/interface/dialog.c b/src/interface/dialog.c
index 874005a..7cb9cd6 100644
--- a/src/interface/dialog.c
+++ b/src/interface/dialog.c
@@ -145,13 +145,12 @@ dialog_id_release(vlc_dialog_id *p_id)
     free(p_id);
 }
 
-int
-libvlc_dialog_provider_init(libvlc_int_t *p_libvlc)
+vlc_dialog_provider *
+vlc_dialog_provider_new(void)
 {
-    assert(p_libvlc != NULL);
     vlc_dialog_provider *p_provider = malloc(sizeof(*p_provider));
-    if (p_provider == NULL)
-        return VLC_EGENERIC;
+    if( p_provider == NULL )
+        return NULL;
 
     vlc_mutex_init(&p_provider->lock);
     vlc_array_init(&p_provider->dialog_array);
@@ -161,9 +160,8 @@ libvlc_dialog_provider_init(libvlc_int_t *p_libvlc)
 
     p_provider->pf_ext_update = NULL;
     p_provider->p_ext_data = NULL;
-    libvlc_priv(p_libvlc)->p_dialog_provider = p_provider;
 
-    return VLC_SUCCESS;
+    return p_provider;
 }
 
 static int
@@ -241,10 +239,9 @@ dialog_clear_all_locked(vlc_dialog_provider *p_provider)
 }
 
 void
-libvlc_dialog_provider_deinit(libvlc_int_t *p_libvlc)
+vlc_dialog_provider_release(vlc_dialog_provider *p_provider)
 {
-    assert(p_libvlc != NULL);
-    vlc_dialog_provider *p_provider = libvlc_priv(p_libvlc)->p_dialog_provider;
+    assert(p_provider != NULL);
 
     vlc_mutex_lock(&p_provider->lock);
     dialog_clear_all_locked(p_provider);
@@ -252,7 +249,6 @@ libvlc_dialog_provider_deinit(libvlc_int_t *p_libvlc)
 
     vlc_mutex_destroy(&p_provider->lock);
     free(p_provider);
-    libvlc_priv(p_libvlc)->p_dialog_provider = NULL;
 }
 
 #undef vlc_dialog_provider_set_callbacks
diff --git a/src/libvlc.c b/src/libvlc.c
index fc4a59d..ff0b618 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -235,7 +235,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     }
 #endif
 
-    if( libvlc_dialog_provider_init( p_libvlc ) != VLC_SUCCESS )
+    priv->p_dialog_provider = vlc_dialog_provider_new();
+    if( priv->p_dialog_provider == NULL )
     {
         vlc_LogDeinit (p_libvlc);
         module_EndBank (true);
@@ -510,7 +511,7 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
     libvlc_Quit( p_libvlc );
     intf_DestroyAll( p_libvlc );
 
-    libvlc_dialog_provider_deinit( p_libvlc );
+    vlc_dialog_provider_release( priv->p_dialog_provider );
 
 #ifdef ENABLE_VLM
     /* Destroy VLM if created in libvlc_InternalInit */



More information about the vlc-commits mailing list