Preserve FcConfig in SkFontConfigInterface_direct methods.

It is possible that some other thread will change the default FcConfig
out from under one of these methods, which is a terrible race. Prevent
this by taking a reference to the default FcConfig in the method and
keeping it alive while it is being used.

Previously an attempt was made to hold onto the FcConfig for the
lifetime of the SkFontConfigInterface_direct object. Unfortunately, some
users are holing onto SkFontConfigInterface_direct as a global and so it
is not obvious to free all instances before calling FcFini, which will
asert that no instances are still using the cache.

Bug: chromium:1004254
Change-Id: Ia173e90b95c43c40d91b366095eb97c0e466ab86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246216
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
1 file changed