changeset 7677:1f035c12f6f5

[gaim-migrate @ 8321] Fix a segfault caused by: 1) Open accounts editor 2) Select an account and click "Delete" 3) Close the accounts editor 4) Select "Delete" on the "Delete account?" dialog I also changed a statically allocated string to make it dynamic... 8k is overkill for something that is probably less than 100 bytes... Plus, dynamic stuff rocks. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 01 Dec 2003 02:19:27 +0000
parents 5c5acdf8b982
children cf6a7939af78
files src/gtkaccount.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkaccount.c	Mon Dec 01 00:09:48 2003 +0000
+++ b/src/gtkaccount.c	Mon Dec 01 02:19:27 2003 +0000
@@ -1593,7 +1593,8 @@
 
 	index = g_list_index(gaim_accounts_get_all(), account);
 
-	if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(accounts_window->model),
+	if ((accounts_window != NULL) &&
+		gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(accounts_window->model),
 									  &iter, NULL, index)) {
 
 		gtk_list_store_remove(accounts_window->model, &iter);
@@ -1611,15 +1612,15 @@
 	gtk_tree_model_get(model, iter, COLUMN_DATA, &account, -1);
 
 	if (account != NULL) {
-		char buf[8192];
+		char *buf;
 
-		g_snprintf(buf, sizeof(buf),
-				   _("Are you sure you want to delete %s?"),
-				   gaim_account_get_username(account));
+		buf = g_strdup_printf(_("Are you sure you want to delete %s?"),
+							  gaim_account_get_username(account));
 
 		gaim_request_action(NULL, NULL, buf, NULL, 1, account, 2,
 							_("Delete"), delete_account_cb,
 							_("Cancel"), NULL);
+		g_free(buf);
 	}
 }