evas: Stop initializing and shutting Fontconfig down
authorRaphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Mon, 4 Feb 2013 15:37:41 +0000 (15:37 +0000)
committerBruno Dilly <bdilly@profusion.mobi>
Mon, 4 Feb 2013 15:37:41 +0000 (15:37 +0000)
commit29dd8e2b47f82171942dc6808901e2b503910513
treee74441428526e1480e9bf37b17ab3b6aa72c88cd
parentb236ac69bdad85c2544cf8feff0cc25ebd5d7c98
evas: Stop initializing and shutting Fontconfig down

A few days ago I was investigating a bug in the EFL WebKit port and
noticed WebKit's and Evas' handling of Fontconfig are somewhat
incompatible: while the evas_font code calls both FcInit() and FcFini()
when on initialization and shutdown, respectively, WebKit keeps some
Fontconfig objects alive until the process exits. In practice, this
means that shutting Evas down will cause FcFini() to assert because
there are objects which have not been properly destroyed.

This is not really a WebKit-specific problem, as any program which also
uses Fontconfig directly and shuts Evas down before destroying all FC
resources it has allocated is going to crash in the same way.

Other libraries such as Qt, Pango and Cairo do not explicitly initialize
and shut Fontconfig down. Evas itself got this code in r40242 and was
later adjusted in r45829 and r74870.

Since we can't completely control the lifetime of all Fontconfig objects
used in client code, I was thinking of doing the same thing as other
libraries do and get rid of the calls to FcInit() and FcFini(). The part
which is really important is not calling FcFini() -- this was already
done for a while in the r45829 which I mentioned. Valgrind will complain
about some "still reachable" memory blocks, but that's not really
important (as raster said in that revision's commit message, "things may
look like they leak in Valgrind - they dont. in reality").

Note: tasn tried to talk about it with fc guys and it's the
way to go. They won't implemented refcount as suggested in our ml.

Patch by: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>

SVN revision: 83605
src/lib/evas/canvas/evas_font_dir.c