[vlc-devel] commit: qt4(Win32): correct crash when saving preferences (Erwan Tulou )

git version control git at videolan.org
Thu Aug 27 15:00:18 CEST 2009


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Aug 27 14:22:14 2009 +0200| [26c0d12f9a06670adcb7081245aaf8e94b3e3cbf] | committer: Erwan Tulou 

qt4(Win32): correct crash when saving preferences

The way options are stored in a list by append and retrieve by named index
(enum list) is kind of risky. Errors can easily occur, some are obvious
 (crash), others may be more silent.

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

 modules/gui/qt4/components/simple_preferences.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp
index 2911052..ee7d4ee 100644
--- a/modules/gui/qt4/components/simple_preferences.cpp
+++ b/modules/gui/qt4/components/simple_preferences.cpp
@@ -519,6 +519,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             optionWidgets.append( ui.stylesCombo );
 #else
             ui.stylesCombo->hide();
+            optionWidgets.append( NULL );
 #endif
 
             ui.skins_zone->setEnabled( ui.skins->isChecked() );
@@ -760,8 +761,9 @@ void SPrefsPanel::apply()
             config_PutPsz( p_intf, "intf", "skins2" );
         if( qobject_cast<QRadioButton *>(optionWidgets[qtRB])->isChecked() )
             config_PutPsz( p_intf, "intf", "qt" );
-        getSettings()->setValue( "MainWindow/QtStyle",
-            qobject_cast<QComboBox *>(optionWidgets[styleCB])->currentText() );
+        if( qobject_cast<QComboBox *>(optionWidgets[styleCB]) )
+            getSettings()->setValue( "MainWindow/QtStyle",
+                qobject_cast<QComboBox *>(optionWidgets[styleCB])->currentText() );
 
         break;
     }




More information about the vlc-devel mailing list