evas/cserve2: fix memory leak when changing font hinting.
authorJean-Philippe Andre <jp.andre@samsung.com>
Tue, 4 Jun 2013 10:44:52 +0000 (19:44 +0900)
committerCedric Bail <cedric.bail@samsung.com>
Tue, 4 Jun 2013 11:21:15 +0000 (20:21 +0900)
Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
src/lib/evas/common/evas_font_load.c

index 97dfb176729b5fe419d6546c8cd59962fa5ef2a4..6a94c9cf0c4cead39891eb56b1bbd4c211fa90d9 100644 (file)
@@ -671,6 +671,15 @@ evas_common_font_free(RGBA_Font *fn)
    free(fn);
 }
 
+static void
+_evas_common_font_rehint(RGBA_Font_Int *fi, Font_Hint_Flags hinting)
+{
+   if (fi->fash)
+     fi->fash->freeme(fi->fash);
+   fi->fash = NULL;
+   fi->hinting = hinting;
+}
+
 EAPI void
 evas_common_font_hinting_set(RGBA_Font *fn, Font_Hint_Flags hinting)
 {
@@ -681,6 +690,8 @@ evas_common_font_hinting_set(RGBA_Font *fn, Font_Hint_Flags hinting)
    fn->hinting = hinting;
    EINA_LIST_FOREACH(fn->fonts, l, fi)
      {
+        if (fi->hinting != fn->hinting)
+          _evas_common_font_rehint(fi, fn->hinting);
         fi->hinting = fn->hinting;
      }
 }