summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-12-21 04:48:18 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-12-21 04:48:18 +0000
commit016b953ce54bcb5aaf9e68f57c788da349f5aff2 (patch)
treef637a90230f06890896defa8f9a4b27f792db848
parentddd9ab07c02e1c228dba5771e47a8f6a9c1506cd (diff)
From: Jérémy Zurcher <jeremy@asynk.ch>
Subject: [E-devel] mixer module segv patch - prevent segv while playing with controls when a card with empty channel list is selected (ie webcam) SVN revision: 81506
-rw-r--r--src/modules/mixer/app_mixer.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/modules/mixer/app_mixer.c b/src/modules/mixer/app_mixer.c
index 737bf861f..1131cbd9a 100644
--- a/src/modules/mixer/app_mixer.c
+++ b/src/modules/mixer/app_mixer.c
@@ -125,10 +125,34 @@ _cb_changed_lock_sliders(void *data, Evas_Object *obj __UNUSED__)
125} 125}
126 126
127static void 127static void
128_disable_channel_editor(E_Mixer_App_Dialog_Data *app)
129{
130 struct e_mixer_app_ui_channel_editor *ui = &app->ui.channel_editor;
131
132 e_widget_entry_text_set(ui->card, "");
133 e_widget_entry_text_set(ui->channel, "");
134 e_widget_entry_text_set(ui->type, "");
135
136 e_widget_slider_value_int_set(ui->left, 0);
137 e_widget_slider_value_int_set(ui->right, 0);
138 e_widget_check_checked_set(ui->mute, 0);
139 e_widget_check_checked_set(ui->lock_sliders, 0);
140
141 e_widget_disabled_set(ui->left, 1);
142 e_widget_disabled_set(ui->right, 1);
143 e_widget_disabled_set(ui->mute, 1);
144 e_widget_disabled_set(ui->lock_sliders, 1);
145}
146
147static void
128_update_channel_editor_state(E_Mixer_App_Dialog_Data *app, const E_Mixer_Channel_State state) 148_update_channel_editor_state(E_Mixer_App_Dialog_Data *app, const E_Mixer_Channel_State state)
129{ 149{
130 struct e_mixer_app_ui_channel_editor *ui = &app->ui.channel_editor; 150 struct e_mixer_app_ui_channel_editor *ui = &app->ui.channel_editor;
131 151
152 e_widget_disabled_set(ui->left, 0);
153 e_widget_disabled_set(ui->right, 0);
154 e_widget_disabled_set(ui->lock_sliders, 0);
155
132 e_widget_slider_value_int_set(ui->left, state.left); 156 e_widget_slider_value_int_set(ui->left, state.left);
133 e_widget_slider_value_int_set(ui->right, state.right); 157 e_widget_slider_value_int_set(ui->right, state.right);
134 158
@@ -154,7 +178,10 @@ _populate_channel_editor(E_Mixer_App_Dialog_Data *app)
154 card_name = e_mod_mixer_card_name_get(app->card); 178 card_name = e_mod_mixer_card_name_get(app->card);
155 179
156 if (!card_name) 180 if (!card_name)
157 return; 181 {
182 _disable_channel_editor(app);
183 return;
184 }
158 185
159 e_widget_entry_text_set(ui->card, card_name); 186 e_widget_entry_text_set(ui->card, card_name);
160 eina_stringshare_del(card_name); 187 eina_stringshare_del(card_name);
@@ -321,7 +348,10 @@ static void
321select_card(E_Mixer_App_Dialog_Data *app) 348select_card(E_Mixer_App_Dialog_Data *app)
322{ 349{
323 _populate_channels(app); 350 _populate_channels(app);
324 e_widget_ilist_selected_set(app->ui.channels.list, 1); 351 if (e_widget_ilist_count(app->ui.channels.list) > 0)
352 e_widget_ilist_selected_set(app->ui.channels.list, 1);
353 else
354 _disable_channel_editor(app);
325} 355}
326 356
327static void 357static void