# HG changeset patch
# User Mark Doliner <mark@kingant.net>
# Date 1070245167 0
# Node ID 1f035c12f6f5fcf6ae14fefdab4e75520def661c
# Parent  5c5acdf8b98293627952928245764195bcdf390a
[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>

diff -r 5c5acdf8b982 -r 1f035c12f6f5 src/gtkaccount.c
--- 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);
 	}
 }