]> granicus.if.org Git - libass/commitdiff
render_api: fix crash when calling ass_set_fonts() after rendering
authorwm4 <wm4@nowhere>
Fri, 28 Aug 2015 16:34:36 +0000 (18:34 +0200)
committerwm4 <wm4@nowhere>
Fri, 28 Aug 2015 16:34:36 +0000 (18:34 +0200)
The caches may reference data which belongs to the font provider. If the
font selector and the font provider are destroyed, it can leave dangling
pointers in the renderer cache. (At least that's what it looks like.)

For some reason, this didn't even trigger valgrind warnings with the
fontconfig font provider. Possibly the dangling pointers were FT_Face
pointers, and fontconfig might cache these process-wide.

libass/ass_render_api.c

index a23cd20768571d9041334c64835e8e2ae8a07be0..975cd6379f81dd110a08a7436eb627a3eb9c7b60 100644 (file)
@@ -144,6 +144,8 @@ void ass_set_fonts(ASS_Renderer *priv, const char *default_font,
     priv->settings.default_family =
         default_family ? strdup(default_family) : 0;
 
+    ass_reconfigure(priv);
+
     if (priv->fontselect)
         ass_fontselect_free(priv->fontselect);
     priv->fontselect = ass_fontselect_init(priv->library, priv->ftlibrary,