[vlc-commits] Undo misuse of module_config_t.b_dirty

Rémi Denis-Courmont git at videolan.org
Sun Apr 1 11:43:19 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr  1 12:33:39 2012 +0300| [5eeeb50da9a0dc92e265f11861d786307a23b4eb] | committer: Rémi Denis-Courmont

Undo misuse of module_config_t.b_dirty

This fixes a bug whereby the configuration would not be saved because
Qt4 cleared the b_dirty flag instead of minding its own business.

The core determines whether the value of a configuration item as changed
using b_dirty. b_dirty is _not_ meant to signal changes in choices list.
Configuration callbacks blindly set b_dirty, so the UI can assume that
choices changed. Besides those callbacks should be removed as they do
not follow the locking model of the configuration and can cause crashes.

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

 modules/access/dshow/dshow.cpp                     |    3 --
 modules/audio_output/alsa.c                        |    3 --
 modules/audio_output/directx.c                     |    3 --
 modules/audio_output/waveout.c                     |    3 --
 modules/gui/qt4/components/preferences_widgets.cpp |   31 ++-----------------
 modules/video_output/msw/directx.c                 |    3 --
 6 files changed, 4 insertions(+), 42 deletions(-)

diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index bf1ea82..130a148 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -2074,9 +2074,6 @@ static int FindDevicesCallback( vlc_object_t *p_this, char const *psz_name,
     p_item->ppsz_list[i] = NULL;
     p_item->ppsz_list_text[i] = NULL;
 
-    /* Signal change to the interface */
-    p_item->b_dirty = true;
-
     return VLC_SUCCESS;
 }
 
diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index 5f6385b..09721fe 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -759,9 +759,6 @@ static int FindDevicesCallback( vlc_object_t *p_this, char const *psz_name,
 
     GetDevices (p_this, p_item, "default");
 
-    /* Signal change to the interface */
-    p_item->b_dirty = true;
-
     return VLC_SUCCESS;
 }
 
diff --git a/modules/audio_output/directx.c b/modules/audio_output/directx.c
index f74eb67..4cd8c99 100644
--- a/modules/audio_output/directx.c
+++ b/modules/audio_output/directx.c
@@ -1162,9 +1162,6 @@ static int ReloadDirectXDevices( vlc_object_t *p_this, char const *psz_name,
     p_item->i_list = 0;
     OurDirectSoundEnumerate(CallBackConfigEnum, p_item);
 
-    /* Signal change to the interface */
-    p_item->b_dirty = true;
-
 error:
     FreeLibrary(hdsound_dll);
 
diff --git a/modules/audio_output/waveout.c b/modules/audio_output/waveout.c
index 357b613..77b448f 100644
--- a/modules/audio_output/waveout.c
+++ b/modules/audio_output/waveout.c
@@ -1076,9 +1076,6 @@ static int ReloadWaveoutDevices( vlc_object_t *p_this, char const *psz_name,
     p_item->ppsz_list[j] = NULL;
     p_item->ppsz_list_text[j] = NULL;
 
-    /* Signal change to the interface */
-    p_item->b_dirty = true;
-
     return VLC_SUCCESS;
 }
 
diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp
index 4d697b8..61c9cf4 100644
--- a/modules/gui/qt4/components/preferences_widgets.cpp
+++ b/modules/gui/qt4/components/preferences_widgets.cpp
@@ -446,12 +446,8 @@ void StringListConfigControl::actionRequested( int i_action )
 
     p_module_config->ppf_action[i_action]( p_this, getName(), val, val, 0 );
 
-    if( p_module_config->b_dirty )
-    {
-        combo->clear();
-        finish( p_module_config );
-        p_module_config->b_dirty = false;
-    }
+    combo->clear();
+    finish( p_module_config );
 }
 
 StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
@@ -479,12 +475,6 @@ void StringListConfigControl::finish(module_config_t *p_module_config )
         val.psz_string = strdup(p_module_config->value.psz);
 
         p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
-
-        // assume in any case that dirty was set to true
-        // because lazy programmes will use the same callback for
-        // this, like the one behind the refresh push button?
-        p_module_config->b_dirty = false;
-
         free( val.psz_string );
     }
 
@@ -543,10 +533,6 @@ void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf,
             vlc_value_t val;
             val.i_int = p_config->value.i;
             p_config->pf_update_list(VLC_OBJECT(p_intf), configname, val, val, NULL);
-            // assume in any case that dirty was set to true
-            // because lazy programmes will use the same callback for
-            // this, like the one behind the refresh push button?
-            p_config->b_dirty = false;
         }
 
         for ( int i_index = 0; i_index < p_config->i_list; i_index++ )
@@ -991,11 +977,6 @@ void IntegerListConfigControl::finish(module_config_t *p_module_config )
        val.i_int = p_module_config->value.i;
 
        p_module_config->pf_update_list(p_this, p_item->psz_name, val, val, NULL);
-
-       // assume in any case that dirty was set to true
-       // because lazy programmes will use the same callback for
-       // this, like the one behind the refresh push button?
-       p_module_config->b_dirty = false;
     }
 
     for( int i_index = 0; i_index < p_module_config->i_list; i_index++ )
@@ -1030,12 +1011,8 @@ void IntegerListConfigControl::actionRequested( int i_action )
 
     p_module_config->ppf_action[i_action]( p_this, getName(), val, val, 0 );
 
-    if( p_module_config->b_dirty )
-    {
-        combo->clear();
-        finish( p_module_config );
-        p_module_config->b_dirty = false;
-    }
+    combo->clear();
+    finish( p_module_config );
 }
 
 int IntegerListConfigControl::getValue() const
diff --git a/modules/video_output/msw/directx.c b/modules/video_output/msw/directx.c
index b4797d1..84d092f 100644
--- a/modules/video_output/msw/directx.c
+++ b/modules/video_output/msw/directx.c
@@ -1471,9 +1471,6 @@ static int FindDevicesCallback(vlc_object_t *object, char const *name,
 
     FreeLibrary(hddraw_dll);
 
-    /* Signal change to the interface */
-    item->b_dirty = true;
-
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list