evas: don't forget to destroy all the cached Evas_Text_Props on font change.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 20 Jun 2012 05:02:57 +0000 (05:02 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 20 Jun 2012 05:02:57 +0000 (05:02 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@72516 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_object_textgrid.c

index e8ea707..187e8ae 100644 (file)
@@ -1175,6 +1175,27 @@ evas_object_textgrid_font_set(Evas_Object *obj, const char *font_name, Evas_Font
    o->core_change = 1;
    evas_object_textgrid_rows_clear(obj);
    evas_object_change(obj);
+
+   /* Force destroy of all cached Evas_Text_Props */
+   while (eina_array_count(&o->glyphs_cleanup) > 0)
+     {
+        Evas_Text_Props *prop;
+        unsigned int props_index;
+
+        props_index = (unsigned int) (intptr_t) eina_array_pop(&o->glyphs_cleanup);
+        prop = &(o->glyphs[props_index >> 8].props[props_index & 0xFF]);
+        
+        evas_common_text_props_content_unref(prop);
+        if (!prop->info)
+          {
+             o->glyphs_used[props_index >> 8]--;
+
+             if (!o->glyphs_used[props_index >> 8])
+               {
+                  /* FIXME: cleanup the master tree */
+               }
+          }
+     }
 }
 
 EAPI void