changeset 3485:6187c93da61a

[gaim-migrate @ 3539] Bugfix by Chris Rankin. Thanks, Chris! committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 31 Aug 2002 02:49:25 +0000
parents 5d1dff030d8b
children 8e688863a9f1
files src/prefs.c
diffstat 1 files changed, 17 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/prefs.c	Sat Aug 31 02:40:51 2002 +0000
+++ b/src/prefs.c	Sat Aug 31 02:49:25 2002 +0000
@@ -95,18 +95,19 @@
 void delete_prefs(GtkWidget *asdf, void *gdsa) {
 	int v;
 	
-	 prefs = NULL;
-	 for (v = 0; v < NUM_SOUNDS; v++) {
-		if (sound_file_new[v] && (sound_file_new[v] != sound_file[v]))
+	prefs = NULL;
+	for (v = 0; v < NUM_SOUNDS; v++) {
+		if (sound_file_new[v]) {
 			g_free(sound_file_new[v]);
-		sound_file_new[v] = NULL;
-	 }
-	 sound_entry = NULL;
-	 browser_entry = NULL;
-	 debugbutton=NULL;
-	 if(sounddialog)
+			sound_file_new[v] = NULL;
+		}
+	}
+	sound_entry = NULL;
+	browser_entry = NULL;
+	debugbutton=NULL;
+	if(sounddialog)
 		gtk_widget_destroy(sounddialog);
-	 g_object_unref(G_OBJECT(prefs_away_store)); 	
+	g_object_unref(G_OBJECT(prefs_away_store)); 	
 }
 
 GtkWidget *preflabel;
@@ -187,7 +188,7 @@
 	for (r = 0; r < NUM_SOUNDS; r++) {
 		if (sound_file[r])
 			g_free(sound_file[r]);
-		sound_file[r] = sound_file_new[r];
+		sound_file[r] = g_strdup(sound_file_new[r]);
 	}
 	if (away_options != away_options_new)		
 		set_away_options();
@@ -871,9 +872,11 @@
 
 static void reset_sound(GtkWidget *button, gpointer i_am_also_NULL)
 {
-
 	/* This just resets a sound file back to default */
-	sound_file_new[sound_row_sel] = NULL;
+	if (sound_file_new[sound_row_sel]) {
+		g_free(sound_file_new[sound_row_sel]);
+		sound_file_new[sound_row_sel] = NULL;
+	}
 
 	gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)");
 }
@@ -905,7 +908,7 @@
 
 	/* Let's just be safe */
 	if (sound_file_new[snd])
-		free(sound_file_new[snd]);
+		g_free(sound_file_new[snd]);
 
 	/* Set it -- and forget it */
 	sound_file_new[snd] = g_strdup(file);