[evolution-patches] [gtkhtml] another leak fix
- From: Radek Doulik <rodo novell com>
- To: Patches <evolution-patches ximian com>
- Cc: Rodney Dawes <dobey novell com>, Rodrigo Moya <rodrigo novell com>
- Subject: [evolution-patches] [gtkhtml] another leak fix
- Date: Fri, 29 Apr 2005 12:17:11 +0530
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2117
diff -p -u -r1.2117 ChangeLog
--- ChangeLog 28 Apr 2005 11:20:17 -0000 1.2117
+++ ChangeLog 29 Apr 2005 06:48:24 -0000
@@ -1,3 +1,14 @@
+2005-04-29 Radek Doulik <rodo site>
+
+ * htmlcluev.c (html_cluev_set_style): unref background color
+ before setting new value we get from style. fix typo where we were
+ unrefing border color twice instead of freeing background_color
+ (html_cluev_destroy): added destructor so that we unref colors we
+ got from style
+
+ * htmlengine.c (element_parse_html): free the element before
+ leaving the function
+
2005-04-28 Radek Doulik <rodo site>
* htmlengine.c: created new html_element_new constructor and
Index: htmlengine.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine.c,v
retrieving revision 1.634
diff -p -u -r1.634 htmlengine.c
--- htmlengine.c 28 Apr 2005 11:20:17 -0000 1.634
+++ htmlengine.c 29 Apr 2005 06:48:24 -0000
@@ -1880,11 +1880,15 @@ element_parse_html (HTMLEngine *e, HTMLO
element = html_element_new_parse (e, str);
- if (e->parser_clue && html_element_get_attr (element, "dir", &value)) {
- if (!strcasecmp (value, "ltr"))
- HTML_CLUEV (e->parser_clue)->dir = HTML_DIRECTION_LTR;
- else if (!strcasecmp (value, "rtl"))
- HTML_CLUEV (e->parser_clue)->dir = HTML_DIRECTION_RTL;
+ if (element) {
+ if (e->parser_clue && html_element_get_attr (element, "dir", &value)) {
+ if (!strcasecmp (value, "ltr"))
+ HTML_CLUEV (e->parser_clue)->dir = HTML_DIRECTION_LTR;
+ else if (!strcasecmp (value, "rtl"))
+ HTML_CLUEV (e->parser_clue)->dir = HTML_DIRECTION_RTL;
+ }
+
+ html_element_free (element);
}
}
Index: htmlcluev.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlcluev.c,v
retrieving revision 1.82
diff -p -u -r1.82 htmlcluev.c
--- htmlcluev.c 23 Mar 2005 12:35:57 -0000 1.82
+++ htmlcluev.c 29 Apr 2005 06:48:24 -0000
@@ -892,6 +892,22 @@ html_cluev_real_get_direction (HTMLObjec
return HTML_CLUEV (o)->dir;
}
+static void
+html_cluev_destroy (HTMLObject *self)
+{
+ HTMLClueV *cluev = HTML_CLUEV (self);
+
+ if (cluev->border_color)
+ html_color_unref (cluev->border_color);
+ cluev->border_color = NULL;
+
+ if (cluev->background_color)
+ html_color_unref (cluev->background_color);
+ cluev->background_color = NULL;
+
+ (* HTML_OBJECT_CLASS (parent_class)->destroy) (self);
+}
+
void
html_cluev_type_init (void)
@@ -925,6 +941,7 @@ html_cluev_class_init (HTMLClueVClass *k
object_class->get_left_margin = get_left_margin;
object_class->get_right_margin = get_right_margin;
object_class->get_direction = html_cluev_real_get_direction;
+ object_class->destroy = html_cluev_destroy;
clue_class->get_left_clear = get_left_clear;
clue_class->get_right_clear = get_right_clear;
@@ -986,6 +1003,9 @@ html_cluev_set_style (HTMLClueV *cluev,
if (cluev->border_color)
html_color_unref (cluev->border_color);
+ if (cluev->background_color)
+ html_color_unref (cluev->background_color);
+
cluev->padding = style->padding;
cluev->border_style = style->border_style;
@@ -1001,7 +1021,7 @@ html_cluev_set_style (HTMLClueV *cluev,
if (cluev->border_color)
html_color_unref (cluev->border_color);
- if (cluev->border_color)
+ if (cluev->background_color)
html_color_unref (cluev->background_color);
cluev->border_style = HTML_BORDER_NONE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]