diff options
-rw-r--r-- | source/blender/blenkernel/intern/icons.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index e1d1211f6e5..f1f343faac8 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -564,8 +564,12 @@ static int icon_id_ensure_create_icon(struct ID *id) int BKE_icon_id_ensure(struct ID *id) { - if (!id || G.background) + /* Never handle icons in non-main thread! */ + BLI_assert(BLI_thread_is_main()); + + if (!id || G.background) { return 0; + } if (id->icon_id) return id->icon_id; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 8b447bca59f..e5c192b3e1e 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -3129,9 +3129,11 @@ static void image_create_multilayer(Image *ima, ImBuf *ibuf, int framenr) /* common stuff to do with images after loading */ static void image_initialize_after_load(Image *ima, ImBuf *ibuf) { - /* preview is NULL when it has never been used as an icon before */ - if (G.background == 0 && ima->preview == NULL) + /* Preview is NULL when it has never been used as an icon before. + * Never handle previews/icons outside of main thread. */ + if (G.background == 0 && ima->preview == NULL && BLI_thread_is_main()) { BKE_icon_changed(BKE_icon_id_ensure(&ima->id)); + } /* fields */ if (ima->flag & IMA_FIELDS) { |