diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-05-04 08:07:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-05-04 09:01:20 +0300 |
commit | 77e6a001a96b7eb3b2b1c2216a48c85c1b6906e0 (patch) | |
tree | ff2d44f3d8c661445e5d358f11e9043beadb23f0 /source/blender/editors/util/ed_util.c | |
parent | 8d5e57748a777a76dbbe85d432d7d8364775713a (diff) |
Fix T44376: Buttons context, invalid data access
Removing a scene from the buttons window would crash from a Python operator.
Diffstat (limited to 'source/blender/editors/util/ed_util.c')
-rw-r--r-- | source/blender/editors/util/ed_util.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 438eb1f3864..d162becfe98 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -38,6 +38,7 @@ #include "DNA_mesh_types.h" #include "DNA_object_types.h" #include "DNA_screen_types.h" +#include "DNA_space_types.h" #include "DNA_scene_types.h" #include "DNA_packedFile_types.h" @@ -58,9 +59,11 @@ #include "BKE_paint.h" #include "ED_armature.h" +#include "ED_buttons.h" #include "ED_image.h" #include "ED_mesh.h" #include "ED_object.h" +#include "ED_outliner.h" #include "ED_paint.h" #include "ED_space_api.h" #include "ED_util.h" @@ -318,3 +321,21 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info glEnd(); setlinestyle(0); } + +/** + * Use to free ID references within runtime data (stored outside of DNA) + * + * \note Typically notifiers take care of this, + * but there are times we have to free references immediately, see: T44376 + */ +void ED_spacedata_id_unref(struct SpaceLink *sl, const ID *id) +{ + switch (sl->spacetype) { + case SPACE_OUTLINER: + ED_outliner_id_unref((SpaceOops *)sl, id); + break; + case SPACE_BUTS: + ED_buttons_id_unref((SpaceButs *)sl, id); + break; + } +} |