? libgtkhtml-2.1.3
? libgtkhtml-2.1.3.tar.gz
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml2/ChangeLog,v
retrieving revision 1.333
diff -u -p -r1.333 ChangeLog
--- ChangeLog	27 Nov 2002 17:23:25 -0000	1.333
+++ ChangeLog	29 Nov 2002 17:26:07 -0000
@@ -1,3 +1,14 @@
+2002-11-29  Padraig O'Briain  <padraig.obriain@sun.com>
+
+	* libgtkhtml/document/htmldocument.c 
+	(html_document_parsed_document_node): Ceeate DomEventListeneronly if
+	it does not already exist. Store the listener in object data.
+	(html_document_clear): Remove DomEventListener if it exists
+
+	* dom/core/dom-node.c (dom_Node_removeEventListener): Fix code.
+
+	This fixes bug #79783.
+
 2002-11-27  Padraig O'Briain  <padraig.obriain@sun.com>
 
 	* libgtkhtml/document/htmldocumet (html_document_clear):
Index: libgtkhtml/document/htmldocument.c
===================================================================
RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/document/htmldocument.c,v
retrieving revision 1.111
diff -u -p -r1.111 htmldocument.c
--- libgtkhtml/document/htmldocument.c	27 Nov 2002 17:23:26 -0000	1.111
+++ libgtkhtml/document/htmldocument.c	29 Nov 2002 17:26:07 -0000
@@ -367,9 +367,14 @@ html_document_parsed_document_node (Html
 {
 	DomEventListener *listener;
 
+	listener = g_object_get_data (G_OBJECT (document), "dom-event-listener");
+	if (listener)
+		return;
+
 	listener = dom_event_listener_signal_new ();
 	g_signal_connect (G_OBJECT (listener), "event",
 			  G_CALLBACK (html_document_dom_event), document);
+	g_object_set_data (G_OBJECT (document), "dom-event-listener", listener);
 	
 	dom_EventTarget_addEventListener (DOM_EVENT_TARGET (document->dom_document),
 					  "DOMNodeInserted", listener, FALSE);
@@ -716,6 +721,7 @@ html_document_clear (HtmlDocument *docum
 	DomNode *tmp_node;
 	GSList *ss;
 	xmlNodePtr top_node;
+	DomEventListener *listener;
 	
 	if (!document->dom_document)
 		return;
@@ -736,6 +742,34 @@ html_document_clear (HtmlDocument *docum
 	}
 
 	xmlFreeNode (top_node);
+
+	listener = g_object_get_data (G_OBJECT (document), "dom-event-listener");
+	if (listener) {
+		g_object_set_data (G_OBJECT (document), "dom-event-listener", NULL);
+	
+		dom_EventTarget_removeEventListener (DOM_EVENT_TARGET (document->dom_document),
+						     "DOMNodeInserted", listener, FALSE);
+		dom_EventTarget_removeEventListener (DOM_EVENT_TARGET (document->dom_document),
+						     "DOMNodeRemoved", listener, FALSE);
+		dom_EventTarget_removeEventListener (DOM_EVENT_TARGET (document->dom_document),
+						     "DOMCharacterDataModified", listener, FALSE);
+		dom_EventTarget_removeEventListener (DOM_EVENT_TARGET (document->dom_document),
+						     "StyleChanged", listener, FALSE);
+		dom_EventTarget_removeEventListener (DOM_EVENT_TARGET (document->dom_document),
+						     "mousedown", listener, FALSE);
+		dom_EventTarget_removeEventListener (DOM_EVENT_TARGET (document->dom_document),
+						     "mouseup", listener, FALSE);
+		dom_EventTarget_removeEventListener (DOM_EVENT_TARGET (document->dom_document),
+						     "click", listener, FALSE);
+		dom_EventTarget_removeEventListener (DOM_EVENT_TARGET (document->dom_document),
+						     "mouseover", listener, FALSE);
+		dom_EventTarget_removeEventListener (DOM_EVENT_TARGET (document->dom_document),
+						     "mouseout", listener, FALSE);
+		dom_EventTarget_removeEventListener (DOM_EVENT_TARGET (document->dom_document),
+						     "submit", listener, FALSE);
+		g_object_unref (listener);
+	}
+
 	g_object_unref (document->dom_document);
 	
 	for (ss = document->stylesheets; ss; ss = ss->next) {
Index: libgtkhtml/dom/core/dom-node.c
===================================================================
RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/dom/core/dom-node.c,v
retrieving revision 1.22
diff -u -p -r1.22 dom-node.c
--- libgtkhtml/dom/core/dom-node.c	27 Nov 2002 17:23:28 -0000	1.22
+++ libgtkhtml/dom/core/dom-node.c	29 Nov 2002 17:26:07 -0000
@@ -616,6 +616,7 @@ dom_Node_removeEventListener (DomEventTa
 			g_free (info);
 			
 			removed = TRUE;
+			break;
 		}
 
 		handler_list = handler_list->next;
