pidgin: 3f1d2c03: Plug a leak of an account dropdown selec...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Tue Jul 7 13:45:33 EDT 2009


-----------------------------------------------------------------
Revision: 3f1d2c03aab34120c7c659a581ffa8d156041d51
Ancestor: da24d9ca9777582ee69619f69067bd6e205cc64b
Author: darkrain42 at pidgin.im
Date: 2009-07-07T17:44:13
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/3f1d2c03aab34120c7c659a581ffa8d156041d51

Modified files:
        pidgin/gtkrequest.c

ChangeLog: 

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

-------------- next part --------------
============================================================
--- pidgin/gtkrequest.c	7fea788d48c6cf310240672883771ca712fb3d4b
+++ pidgin/gtkrequest.c	d61ed4211e527cc244a8b5c22f20096abfe6939f
@@ -717,12 +717,16 @@ setup_entry_field(GtkWidget *entry, Purp
 			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 @@ setup_entry_field(GtkWidget *entry, Purp
 						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;
 					}


More information about the Commits mailing list