Commit 26c0d12f authored by Erwan Tulou's avatar 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.
parent 58f5726f
...@@ -519,6 +519,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -519,6 +519,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
optionWidgets.append( ui.stylesCombo ); optionWidgets.append( ui.stylesCombo );
#else #else
ui.stylesCombo->hide(); ui.stylesCombo->hide();
optionWidgets.append( NULL );
#endif #endif
ui.skins_zone->setEnabled( ui.skins->isChecked() ); ui.skins_zone->setEnabled( ui.skins->isChecked() );
...@@ -760,6 +761,7 @@ void SPrefsPanel::apply() ...@@ -760,6 +761,7 @@ void SPrefsPanel::apply()
config_PutPsz( p_intf, "intf", "skins2" ); config_PutPsz( p_intf, "intf", "skins2" );
if( qobject_cast<QRadioButton *>(optionWidgets[qtRB])->isChecked() ) if( qobject_cast<QRadioButton *>(optionWidgets[qtRB])->isChecked() )
config_PutPsz( p_intf, "intf", "qt" ); config_PutPsz( p_intf, "intf", "qt" );
if( qobject_cast<QComboBox *>(optionWidgets[styleCB]) )
getSettings()->setValue( "MainWindow/QtStyle", getSettings()->setValue( "MainWindow/QtStyle",
qobject_cast<QComboBox *>(optionWidgets[styleCB])->currentText() ); qobject_cast<QComboBox *>(optionWidgets[styleCB])->currentText() );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment