Fix T53686: VSE Render crash when zooming timeline

This is rather a workaround to avoid main thread freeing all glyph caches
at the same time as sequencer uses fonts to draw text sequences.

Ideally we need to either make cache more local, or user-counted or to make
somewhat more global locks. All this ends up in a bigger refactor which is
better for 2.8. For the meantime let's make Blender more stable with a tiny
workaround.

Downside is that keeping zooming things up and down in interface during render
will increase memory usage by unused glyph caches. It's not too bad though,
all unused caches will be freed first time at area zoom after render.

Thanks Bastien for review!
This commit is contained in:
Sergey Sharybin 2018-02-01 16:24:25 +01:00
parent 1a840c3e27
commit 7884ae6eb2
Notes: blender-bot 2023-02-14 10:29:32 +01:00
Referenced by issue #53686, VSE Render crash when zooming timeline
1 changed files with 7 additions and 0 deletions

View File

@ -1027,6 +1027,13 @@ bool UI_view2d_tab_set(View2D *v2d, int tab)
void UI_view2d_zoom_cache_reset(void)
{
/* TODO(sergey): This way we avoid threading conflict with VSE rendering
* text strip. But ideally we want to make glyph cache to be fully safe
* for threading.
*/
if (G.is_rendering) {
return;
}
/* While scaling we can accumulate fonts at many sizes (~20 or so).
* Not an issue with embedded font, but can use over 500Mb with i18n ones! See [#38244]. */