summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2010-08-15 08:17:21 +0000
committerTom Hacohen <tom@stosb.com>2010-08-15 08:17:21 +0000
commit2c2a0cb9285d61bf23ff97fd00cfde31d026517f (patch)
tree015b38852ccf3b0b22bb9c6656196c24ed2e9148 /legacy
parent607e5d4b9bf3c93790fceebfcc14efd694506905 (diff)
Evas textblock: Free paragraphs as well as lines.
Fixes a small memory leak. SVN revision: 51126
Diffstat (limited to 'legacy')
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_textblock.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_object_textblock.c b/legacy/evas/src/lib/canvas/evas_object_textblock.c
index 30099a6636..51c464f891 100644
--- a/legacy/evas/src/lib/canvas/evas_object_textblock.c
+++ b/legacy/evas/src/lib/canvas/evas_object_textblock.c
@@ -1768,6 +1768,8 @@ _paragraph_free(const Evas_Object *obj, Evas_Object_Textblock_Paragraph *par)
1768static void 1768static void
1769_paragraphs_clear(const Evas_Object *obj, Evas_Object_Textblock_Paragraph *pars) 1769_paragraphs_clear(const Evas_Object *obj, Evas_Object_Textblock_Paragraph *pars)
1770{ 1770{
1771 Evas_Object_Textblock *o;
1772 o = (Evas_Object_Textblock *)(obj->object_data);
1771 while (pars) 1773 while (pars)
1772 { 1774 {
1773 Evas_Object_Textblock_Paragraph *par; 1775 Evas_Object_Textblock_Paragraph *par;
@@ -3062,12 +3064,13 @@ _layout(const Evas_Object *obj, int calc_only, int w, int h, int *w_ret, int *h_
3062 o->style_pad.t = style_pad_t; 3064 o->style_pad.t = style_pad_t;
3063 o->style_pad.b = style_pad_b; 3065 o->style_pad.b = style_pad_b;
3064 _layout(obj, calc_only, w, h, w_ret, h_ret); 3066 _layout(obj, calc_only, w, h, w_ret, h_ret);
3065 _lines_clear(obj, lines); 3067 _paragraphs_clear(obj, c->paragraphs);
3066 return; 3068 return;
3067 } 3069 }
3068 if (!calc_only) 3070 if (!calc_only)
3069 { 3071 {
3070 o->lines = c->par->lines; 3072 o->lines = c->par->lines;
3073 o->paragraphs = c->paragraphs;
3071 return; 3074 return;
3072 } 3075 }
3073 if (c->paragraphs) _paragraphs_clear(obj, c->paragraphs); 3076 if (c->paragraphs) _paragraphs_clear(obj, c->paragraphs);
@@ -3080,10 +3083,11 @@ static void
3080_relayout(const Evas_Object *obj) 3083_relayout(const Evas_Object *obj)
3081{ 3084{
3082 Evas_Object_Textblock *o; 3085 Evas_Object_Textblock *o;
3083 Evas_Object_Textblock_Line *lines; 3086 Evas_Object_Textblock_Paragraph *paragraphs;
3084 3087
3085 o = (Evas_Object_Textblock *)(obj->object_data); 3088 o = (Evas_Object_Textblock *)(obj->object_data);
3086 lines = o->lines; 3089 paragraphs = o->paragraphs;
3090 o->paragraphs = NULL;
3087 o->lines = NULL; 3091 o->lines = NULL;
3088 o->formatted.valid = 0; 3092 o->formatted.valid = 0;
3089 o->native.valid = 0; 3093 o->native.valid = 0;
@@ -3092,7 +3096,7 @@ _relayout(const Evas_Object *obj)
3092 obj->cur.geometry.w, obj->cur.geometry.h, 3096 obj->cur.geometry.w, obj->cur.geometry.h,
3093 &o->formatted.w, &o->formatted.h); 3097 &o->formatted.w, &o->formatted.h);
3094 o->formatted.valid = 1; 3098 o->formatted.valid = 1;
3095 if (lines) _lines_clear(obj, lines); 3099 if (paragraphs) _paragraphs_clear(obj, paragraphs);
3096 o->last_w = obj->cur.geometry.w; 3100 o->last_w = obj->cur.geometry.w;
3097 o->changed = 0; 3101 o->changed = 0;
3098 o->redraw = 1; 3102 o->redraw = 1;
@@ -6555,10 +6559,10 @@ evas_object_textblock_clear(Evas_Object *obj)
6555 cur->pos = 0; 6559 cur->pos = 0;
6556 6560
6557 } 6561 }
6558 /* FIXME: free the paragraphs as well */ 6562 if (o->paragraphs)
6559 if (o->lines)
6560 { 6563 {
6561 _lines_clear(obj, o->lines); 6564 _paragraphs_clear(obj, o->paragraphs);
6565 o->paragraphs = NULL;
6562 o->lines = NULL; 6566 o->lines = NULL;
6563 } 6567 }
6564 _evas_textblock_changed(o, obj); 6568 _evas_textblock_changed(o, obj);
@@ -7131,9 +7135,10 @@ evas_object_textblock_render_pre(Evas_Object *obj)
7131 if ((o->changed) || 7135 if ((o->changed) ||
7132 (o->last_w != obj->cur.geometry.w)) 7136 (o->last_w != obj->cur.geometry.w))
7133 { 7137 {
7134 Evas_Object_Textblock_Line *lines; 7138 Evas_Object_Textblock_Paragraph *paragraphs;
7135 7139
7136 lines = o->lines; 7140 paragraphs = o->paragraphs;
7141 o->paragraphs = NULL;
7137 o->lines = NULL; 7142 o->lines = NULL;
7138 o->formatted.valid = 0; 7143 o->formatted.valid = 0;
7139 o->native.valid = 0; 7144 o->native.valid = 0;
@@ -7142,7 +7147,10 @@ evas_object_textblock_render_pre(Evas_Object *obj)
7142 obj->cur.geometry.w, obj->cur.geometry.h, 7147 obj->cur.geometry.w, obj->cur.geometry.h,
7143 &o->formatted.w, &o->formatted.h); 7148 &o->formatted.w, &o->formatted.h);
7144 o->formatted.valid = 1; 7149 o->formatted.valid = 1;
7145 if (lines) _lines_clear(obj, lines); 7150 if (paragraphs)
7151 {
7152 _paragraphs_clear(obj, paragraphs);
7153 }
7146 o->last_w = obj->cur.geometry.w; 7154 o->last_w = obj->cur.geometry.w;
7147 o->redraw = 0; 7155 o->redraw = 0;
7148 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj); 7156 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj);