Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-10-27 10:51:10 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-10-27 14:06:14 +0300
commit5f0933f07a548719a850d9cac01aae6709b9dc0b (patch)
treee31af4de22de1ef037cc8fc6784d292dd5be32e3 /source/blender/makesdna/DNA_ID.h
parentf11298692b93c79132b77d0795e6bd6080c62480 (diff)
Fix T49829: Removal of custom icon previews during add-on unregister crashes Blender.
Issue was happening when removal of custom icons was done while they were still being rendered by preview job. Now add a 'deffered deletion' system, to prevent main thread to delete preview image until loading thread is done with them. Note that ideally, calling `ED_preview_kill_jobs()` on custom icon removal would have been simpler, but we don't have easy access to context here...
Diffstat (limited to 'source/blender/makesdna/DNA_ID.h')
-rw-r--r--source/blender/makesdna/DNA_ID.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 5c1bfc229da..feeb2d5e4d7 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -172,6 +172,13 @@ enum ePreviewImage_Flag {
PRV_USER_EDITED = (1 << 1), /* if user-edited, do not auto-update this anymore! */
};
+/* for PreviewImage->tag */
+enum {
+ PRV_TAG_DEFFERED = (1 << 0), /* Actual loading of preview is deffered. */
+ PRV_TAG_DEFFERED_RENDERING = (1 << 1), /* Deffered preview is being loaded. */
+ PRV_TAG_DEFFERED_DELETE = (1 << 2), /* Deffered preview should be deleted asap. */
+};
+
typedef struct PreviewImage {
/* All values of 2 are really NUM_ICON_SIZES */
unsigned int w[2];
@@ -184,12 +191,12 @@ typedef struct PreviewImage {
struct GPUTexture *gputexture[2];
int icon_id; /* Used by previews outside of ID context. */
- char pad[3];
- char use_deferred; /* for now a mere bool, if we add more deferred loading methods we can switch to bitflag. */
+ short tag; /* Runtime data. */
+ char pad[2];
} PreviewImage;
#define PRV_DEFERRED_DATA(prv) \
- (CHECK_TYPE_INLINE(prv, PreviewImage *), BLI_assert((prv)->use_deferred), (void *)((prv) + 1))
+ (CHECK_TYPE_INLINE(prv, PreviewImage *), BLI_assert((prv)->tag & PRV_TAG_DEFFERED), (void *)((prv) + 1))
/**
* Defines for working with IDs.