changeset 27401:8a46d5528c3c

Plug a leak of an account dropdown selection dialog or two. The optmenu was being assigned to the wrong field, meaning it would be created twice (the latter when pidgin_request_fields hits that field). On top of that, the dropdown was being created even when the field isn't visible (which, in the case of one active account and the New IM dialog, it isn't). Fixes a bunch of failed assertions in the debug log like: g_log: purple_request_field_account_set_value: assertion `field->type == PURPLE_REQUEST_FIELD_ACCOUNT' failed
author Paul Aurich <paul@darkrain42.org>
date Tue, 07 Jul 2009 17:44:13 +0000
parents ebb0f7d27f5b
children 531454a6026d
files pidgin/gtkrequest.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkrequest.c	Tue Jul 07 05:09:53 2009 +0000
+++ b/pidgin/gtkrequest.c	Tue Jul 07 17:44:13 2009 +0000
@@ -717,12 +717,16 @@
 			GtkWidget *optmenu = NULL;
 			PurpleRequestFieldGroup *group = purple_request_field_get_group(field);
 			GList *fields = group->fields;
+
+			/* Ensure the account option menu is created (if the widget hasn't
+			 * been initialized already) for username auto-completion. */
 			while (fields)
 			{
 				PurpleRequestField *fld = fields->data;
 				fields = fields->next;
 
-				if (purple_request_field_get_type(fld) == PURPLE_REQUEST_FIELD_ACCOUNT)
+				if (purple_request_field_get_type(fld) == PURPLE_REQUEST_FIELD_ACCOUNT &&
+						purple_request_field_is_visible(fld))
 				{
 					const char *type_hint = purple_request_field_get_type_hint(fld);
 					if (type_hint != NULL && strcmp(type_hint, "account") == 0)
@@ -730,7 +734,7 @@
 						optmenu = GTK_WIDGET(purple_request_field_get_ui_data(fld));
 						if (optmenu == NULL) {
 							optmenu = GTK_WIDGET(create_account_field(fld));
-							purple_request_field_set_ui_data(field, optmenu);
+							purple_request_field_set_ui_data(fld, optmenu);
 						}
 						break;
 					}