summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-11-21 09:12:42 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-11-21 09:12:42 +0000
commita89d61079c1c2ed1d5113c987f95c9d7263dc48a (patch)
treed5c407c4d56cdaefc24008fc4ddf72a8752fffbf /src
parent2b0829785f0f10213a461fba98dcddea00f4c0d5 (diff)
fix evil textprop leak in textblock! :)
SVN revision: 79503
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_object_textgrid.c21
-rw-r--r--src/lib/evas/common/evas_text_utils.c34
-rw-r--r--src/lib/evas/common/evas_text_utils.h3
3 files changed, 48 insertions, 10 deletions
diff --git a/src/lib/evas/canvas/evas_object_textgrid.c b/src/lib/evas/canvas/evas_object_textgrid.c
index c5a651b503..3ff5c6d214 100644
--- a/src/lib/evas/canvas/evas_object_textgrid.c
+++ b/src/lib/evas/canvas/evas_object_textgrid.c
@@ -197,7 +197,7 @@ evas_object_textgrid_textprop_ref(Evas_Object *eo_obj, Evas_Object_Textgrid *o,
197 197
198 if (o->last_glyphs) 198 if (o->last_glyphs)
199 { 199 {
200 if (o->last_mask && (o->last_mask & codepoint) == o->last_mask) 200 if ((o->last_mask) && ((o->last_mask & codepoint) == o->last_mask))
201 goto end; 201 goto end;
202 } 202 }
203 203
@@ -238,8 +238,8 @@ evas_object_textgrid_textprop_ref(Evas_Object *eo_obj, Evas_Object_Textgrid *o,
238 goto end; 238 goto end;
239 } 239 }
240 240
241 while (shift > 8 241 while ((shift > 8)
242 && o->master[offset].next[(codepoint & mask) >> shift] != 0) 242 && (o->master[offset].next[(codepoint & mask) >> shift] != 0))
243 { 243 {
244 offset = o->master[offset].next[(codepoint & mask) >> shift]; 244 offset = o->master[offset].next[(codepoint & mask) >> shift];
245 mask >>= 4; 245 mask >>= 4;
@@ -325,7 +325,12 @@ evas_object_textgrid_textprop_unref(Evas_Object_Textgrid *o, unsigned int props_
325 eina_array_push(&o->glyphs_cleanup, 325 eina_array_push(&o->glyphs_cleanup,
326 (void *)((uintptr_t)props_index)); 326 (void *)((uintptr_t)props_index));
327 else 327 else
328 evas_common_text_props_content_unref(props); 328 {
329 Evas_Glyph *glyphs = props->glyphs;
330 int glyphs_length = props->glyphs_length;
331
332 evas_common_text_props_content_nofree_unref(props);
333 }
329 } 334 }
330} 335}
331 336
@@ -441,8 +446,8 @@ evas_object_textgrid_free(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
441 446
442 props_index = (unsigned int) (intptr_t) eina_array_pop(&o->glyphs_cleanup); 447 props_index = (unsigned int) (intptr_t) eina_array_pop(&o->glyphs_cleanup);
443 prop = &(o->glyphs[props_index >> 8].props[props_index & 0xFF]); 448 prop = &(o->glyphs[props_index >> 8].props[props_index & 0xFF]);
444 449
445 evas_common_text_props_content_unref(prop); 450 evas_common_text_props_content_nofree_unref(prop);
446 if (!prop->info) 451 if (!prop->info)
447 { 452 {
448 o->glyphs_used[props_index >> 8]--; 453 o->glyphs_used[props_index >> 8]--;
@@ -840,7 +845,7 @@ evas_object_textgrid_render_post(Evas_Object *eo_obj, Evas_Object_Protected_Data
840 props_index = (unsigned int) (intptr_t) eina_array_pop(&o->glyphs_cleanup); 845 props_index = (unsigned int) (intptr_t) eina_array_pop(&o->glyphs_cleanup);
841 prop = &(o->glyphs[props_index >> 8].props[props_index & 0xFF]); 846 prop = &(o->glyphs[props_index >> 8].props[props_index & 0xFF]);
842 847
843 evas_common_text_props_content_unref(prop); 848 evas_common_text_props_content_nofree_unref(prop);
844 if (!prop->info) 849 if (!prop->info)
845 { 850 {
846 o->glyphs_used[props_index >> 8]--; 851 o->glyphs_used[props_index >> 8]--;
@@ -1197,7 +1202,7 @@ _font_set(Eo *eo_obj, void *_pd, va_list *list)
1197 props_index = (unsigned int) (intptr_t) eina_array_pop(&o->glyphs_cleanup); 1202 props_index = (unsigned int) (intptr_t) eina_array_pop(&o->glyphs_cleanup);
1198 prop = &(o->glyphs[props_index >> 8].props[props_index & 0xFF]); 1203 prop = &(o->glyphs[props_index >> 8].props[props_index & 0xFF]);
1199 1204
1200 evas_common_text_props_content_unref(prop); 1205 evas_common_text_props_content_nofree_unref(prop);
1201 if (!prop->info) 1206 if (!prop->info)
1202 { 1207 {
1203 o->glyphs_used[props_index >> 8]--; 1208 o->glyphs_used[props_index >> 8]--;
diff --git a/src/lib/evas/common/evas_text_utils.c b/src/lib/evas/common/evas_text_utils.c
index acdcc0042f..7abf07fa6f 100644
--- a/src/lib/evas/common/evas_text_utils.c
+++ b/src/lib/evas/common/evas_text_utils.c
@@ -54,7 +54,7 @@ evas_common_text_props_content_ref(Evas_Text_Props *props)
54} 54}
55 55
56void 56void
57evas_common_text_props_content_unref(Evas_Text_Props *props) 57evas_common_text_props_content_nofree_unref(Evas_Text_Props *props)
58{ 58{
59 /* No content in this case */ 59 /* No content in this case */
60 if (!props->info) 60 if (!props->info)
@@ -65,13 +65,43 @@ evas_common_text_props_content_unref(Evas_Text_Props *props)
65 evas_common_font_int_unref(props->font_instance); 65 evas_common_font_int_unref(props->font_instance);
66 props->font_instance = NULL; 66 props->font_instance = NULL;
67 } 67 }
68 68
69 if (--(props->info->refcount) == 0) 69 if (--(props->info->refcount) == 0)
70 { 70 {
71 free(props->glyphs); 71 free(props->glyphs);
72 props->glyphs = NULL; 72 props->glyphs = NULL;
73 props->glyphs_length = 0; 73 props->glyphs_length = 0;
74
75 if (props->info->glyph)
76 free(props->info->glyph);
77#ifdef OT_SUPPORT
78 if (props->info->ot)
79 free(props->info->ot);
80#endif
81 free(props->info);
82 props->info = NULL;
83 }
84}
74 85
86void
87evas_common_text_props_content_unref(Evas_Text_Props *props)
88{
89 /* No content in this case */
90 if (!props->info)
91 return;
92
93 if (props->font_instance)
94 {
95 evas_common_font_int_unref(props->font_instance);
96 props->font_instance = NULL;
97 }
98
99 free(props->glyphs);
100 props->glyphs = NULL;
101 props->glyphs_length = 0;
102
103 if (--(props->info->refcount) == 0)
104 {
75 if (props->info->glyph) 105 if (props->info->glyph)
76 free(props->info->glyph); 106 free(props->info->glyph);
77#ifdef OT_SUPPORT 107#ifdef OT_SUPPORT
diff --git a/src/lib/evas/common/evas_text_utils.h b/src/lib/evas/common/evas_text_utils.h
index 675df6c200..2b1caf1d87 100644
--- a/src/lib/evas/common/evas_text_utils.h
+++ b/src/lib/evas/common/evas_text_utils.h
@@ -81,6 +81,9 @@ void
81evas_common_text_props_content_ref(Evas_Text_Props *props); 81evas_common_text_props_content_ref(Evas_Text_Props *props);
82 82
83void 83void
84evas_common_text_props_content_nofree_unref(Evas_Text_Props *props);
85
86void
84evas_common_text_props_content_unref(Evas_Text_Props *props); 87evas_common_text_props_content_unref(Evas_Text_Props *props);
85 88
86EAPI int 89EAPI int