]> git.sesse.net Git - vlc/commitdiff
Reset config if module bank works, save config if VLC exits cleanly
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 2 May 2011 16:33:35 +0000 (19:33 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 2 May 2011 16:37:00 +0000 (19:37 +0300)
src/libvlc.c
src/modules/modules.c

index cceb3e69540c62379c5d73a374c26f2d84df149b..8bb298ec0f57843d1af1b10a9e605d282578a25c 100644 (file)
@@ -461,16 +461,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
         i_ret = VLC_EEXITSUCCESS;
     }
 
-    /* Check for config file options */
-    if( !var_InheritBool( p_libvlc, "ignore-config" ) )
-    {
-        if( var_InheritBool( p_libvlc, "reset-config" ) )
-        {
-            config_ResetAll( p_libvlc );
-            config_SaveConfigFile( p_libvlc );
-        }
-    }
-
     if( module_count <= 1 )
     {
         msg_Err( p_libvlc, "No plugins found! Check your VLC installation.");
@@ -488,7 +478,15 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
      * Override default configuration with config file settings
      */
     if( !var_InheritBool( p_libvlc, "ignore-config" ) )
-        config_LoadConfigFile( p_libvlc );
+    {
+        if( var_InheritBool( p_libvlc, "reset-config" ) )
+        {
+            config_ResetAll( p_libvlc );
+            config_SaveConfigFile( p_libvlc );
+        }
+        else
+            config_LoadConfigFile( p_libvlc );
+    }
 
     /*
      * Override configuration with command line settings
@@ -1032,6 +1030,10 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
         priv->p_memcpy_module = NULL;
     }
 
+    /* Save the configuration */
+    if( !var_InheritBool( p_libvlc, "ignore-config" ) )
+        config_AutoSaveConfigFile( VLC_OBJECT(p_libvlc) );
+
     /* Free module bank. It is refcounted, so we call this each time  */
     module_EndBank( p_libvlc, true );
 
index 01f3583f04be1ef45f5d06dd5c9698000c0d5b7f..2a4f66818bccfd025cd2ae85cdad1cbd7deb3865 100644 (file)
@@ -145,10 +145,6 @@ void module_EndBank( vlc_object_t *p_this, bool b_plugins )
 
     assert (p_bank != NULL);
 
-    /* Save the configuration */
-    if( !var_InheritBool( p_this, "ignore-config" ) )
-        config_AutoSaveConfigFile( p_this );
-
     /* If plugins were _not_ loaded, then the caller still has the bank lock
      * from module_InitBank(). */
     if( b_plugins )