diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-08 17:03:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-08 17:03:04 +0400 |
commit | 85e53317be8f2d390752878dfc0a1aafc33df7ca (patch) | |
tree | 7ef81e83d7319fe4ac567759a932457179040acb /source/blender/blenkernel/intern | |
parent | 3fbaece0d63f9bf9826fee988624f195a8431fa4 (diff) |
fix for bug where notifiers could hold pointers to freed data which listeners would operate on.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 1674fbd55a7..da642f11e8d 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -823,6 +823,14 @@ void set_free_windowmanager_cb(void (*func)(bContext *C, wmWindowManager *) ) free_windowmanager_cb = func; } +static void (*free_notifier_reference_cb)(const void *) = NULL; + +void set_free_notifier_reference_cb(void (*func)(const void *) ) +{ + free_notifier_reference_cb = func; +} + + static void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata) { ChannelDriver *driver; @@ -969,6 +977,10 @@ void BKE_libblock_free(ListBase *lb, void *idv) break; } + /* avoid notifying on removed data */ + if (free_notifier_reference_cb) + free_notifier_reference_cb(id); + BLI_remlink(lb, id); BKE_libblock_free_data(id); |