/pidgin/main: c224f6403237: Fix leaks of WebKit Lists.

Elliott Sales de Andrade qulogic at pidgin.im
Mon Nov 5 18:15:58 EST 2012


Changeset: c224f640323707eb50626defc05e080710795b25
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2012-09-10 01:49 -0400
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/c224f6403237

Description:

Fix leaks of WebKit Lists.

It seems that the WebKitGTK Cookbook indicates that at least these
results should be unref'd.

diffstat:

 pidgin/gtkconv.c  |  2 ++
 pidgin/gtkdebug.c |  8 ++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diffs (56 lines):

diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -1645,6 +1645,8 @@ get_mark_for_user(PidginConversation *gt
 			node = webkit_dom_node_list_item(nodes, len - 1);
 	}
 
+	g_object_unref(nodes);
+
 	return node;
 }
 
diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c
--- a/pidgin/gtkdebug.c
+++ b/pidgin/gtkdebug.c
@@ -216,6 +216,7 @@ regex_toggle_div(WebKitDOMNode *div)
 	classes = webkit_dom_html_element_get_class_list(WEBKIT_DOM_HTML_ELEMENT(div));
 #endif
 	webkit_dom_dom_token_list_toggle(classes, "hide", NULL);
+	g_object_unref(classes);
 }
 
 static void
@@ -242,6 +243,8 @@ regex_highlight_clear(WebKitDOMDocument 
 
 		webkit_dom_node_replace_child(parent, WEBKIT_DOM_NODE(text), span, &err);
 	}
+
+	g_object_unref(nodes);
 }
 
 static void
@@ -402,11 +405,14 @@ regex_toggle_filter(DebugWindow *win, gb
 	/* Re-show debug lines that didn't match regex */
 	list = webkit_dom_document_get_elements_by_class_name(dom, "hide");
 	i = webkit_dom_node_list_get_length(list);
+
 	while (i--) {
 		WebKitDOMNode *div = webkit_dom_node_list_item(list, i);
 		regex_toggle_div(div);
 	}
 
+	g_object_unref(list);
+
 	if (filter) {
 		list = webkit_dom_document_get_elements_by_tag_name(dom, "div");
 
@@ -414,6 +420,8 @@ regex_toggle_filter(DebugWindow *win, gb
 			WebKitDOMNode *div = webkit_dom_node_list_item(list, i);
 			regex_match(win, dom, div);
 		}
+
+		g_object_unref(list);
 	}
 }
 



More information about the Commits mailing list