From: Erwan Tulou Date: Thu, 27 Aug 2009 12:22:14 +0000 (+0200) Subject: qt4(Win32): correct crash when saving preferences X-Git-Tag: 1.1.0-ff~3842 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=26c0d12f9a06670adcb7081245aaf8e94b3e3cbf;p=vlc 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. --- diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp index 29110522de..ee7d4eebe8 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(optionWidgets[qtRB])->isChecked() ) config_PutPsz( p_intf, "intf", "qt" ); - getSettings()->setValue( "MainWindow/QtStyle", - qobject_cast(optionWidgets[styleCB])->currentText() ); + if( qobject_cast(optionWidgets[styleCB]) ) + getSettings()->setValue( "MainWindow/QtStyle", + qobject_cast(optionWidgets[styleCB])->currentText() ); break; }