Fix #105325: crash calling asset_generate_preview() in backgound mode #106046

Merged
Philipp Oeser merged 1 commits from lichtwerk/blender:105325 into main 2023-03-24 09:17:12 +01:00

1 Commits

Author SHA1 Message Date
Philipp Oeser 19b36ca24a Fix #105325: crash calling asset_generate_preview() in backgound mode
`.asset_generate_preview()` internally calls `UI_icon_render_id` as a
job -- as opposed to `.preview_ensure()` [which internally also calls
`UI_icon_render_id`, but not as a job] leading to crashes in background
mode.

This might be due to the fact that OpenGL context is not set up
correctly (so there might be other ways to fix this), but there seems to
be other places/comments indicating that icon handling is only for main
thread (see e.g. 13beeb5892).
And while this does not fully explain why doing this with jobs works fine
from the UI, the patch certainly fixes the crashes in background mode for
now (by not using jobs).
2023-03-24 09:12:20 +01:00