From 4b9216656526839e1d17d899d895dae69182975a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Fri, 22 Jun 2012 15:01:52 +0200 Subject: [PATCH] Fix crashing libcallnotify.so library --- src/usr/lib/hildon-control-panel/libcallnotify.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/usr/lib/hildon-control-panel/libcallnotify.c b/src/usr/lib/hildon-control-panel/libcallnotify.c index 5dc4013..2696abe 100644 --- a/src/usr/lib/hildon-control-panel/libcallnotify.c +++ b/src/usr/lib/hildon-control-panel/libcallnotify.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -17,7 +18,7 @@ osso_return_t execute(osso_context_t *osso, gpointer data, gboolean user_activat GtkAdjustment * adj; gdouble sldValue = 0.0; gdouble newValue = 0.0; - char *fileContent; + char fileContent[64]; char *fileDouble; int i; gint response; @@ -49,6 +50,7 @@ osso_return_t execute(osso_context_t *osso, gpointer data, gboolean user_activat slider = gtk_hscale_new_with_range(0.0, 60.0, 0.1); + adj = gtk_range_get_adjustment(GTK_RANGE(slider)); FILE *inputFilePtr = fopen("/home/user/.config/CallNotify/conf.txt", "r"); @@ -61,11 +63,11 @@ osso_return_t execute(osso_context_t *osso, gpointer data, gboolean user_activat if (fileContent[0]=='y') - hildon_check_button_set_active (GTK_BUTTON(btnVisual), TRUE); + hildon_check_button_set_active (HILDON_CHECK_BUTTON(btnVisual), TRUE); if (fileContent[2]=='y') - hildon_check_button_set_active (GTK_BUTTON(btnVibrate) , TRUE); + hildon_check_button_set_active (HILDON_CHECK_BUTTON(btnVibrate) , TRUE); if (fileContent[4]=='y') - hildon_check_button_set_active (GTK_BUTTON(btnSound), TRUE); + hildon_check_button_set_active (HILDON_CHECK_BUTTON(btnSound), TRUE); (char*)strtok(fileContent, ";"); (char*)strtok(NULL, ";"); @@ -80,12 +82,11 @@ osso_return_t execute(osso_context_t *osso, gpointer data, gboolean user_activat sldValue = g_strtod(fileDouble, NULL); - adj = gtk_range_get_adjustment(GTK_RANGE(slider)); gtk_adjustment_set_value(adj, sldValue); - } + fclose(inputFilePtr); - fclose(inputFilePtr); + } gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), btnVisual); @@ -106,9 +107,9 @@ osso_return_t execute(osso_context_t *osso, gpointer data, gboolean user_activat inputFilePtr = fopen("/home/user/.config/CallNotify/conf.txt", "w"); - a = hildon_check_button_get_active(GTK_BUTTON(btnVisual)) ? 'y' : 'n'; - b = hildon_check_button_get_active(GTK_BUTTON(btnVibrate)) ? 'y' : 'n'; - c = hildon_check_button_get_active(GTK_BUTTON(btnSound)) ? 'y' : 'n'; + a = hildon_check_button_get_active(HILDON_CHECK_BUTTON(btnVisual)) ? 'y' : 'n'; + b = hildon_check_button_get_active(HILDON_CHECK_BUTTON(btnVibrate)) ? 'y' : 'n'; + c = hildon_check_button_get_active(HILDON_CHECK_BUTTON(btnSound)) ? 'y' : 'n'; newValue = gtk_adjustment_get_value(adj); -- 1.7.9.5