diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-09-17 11:23:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-09-17 11:53:00 +0300 |
commit | 76f99bd13ae1359d8256d5c34936a97d833b2c8c (patch) | |
tree | 9d3c0f334c66c90ac656a80a18b061de1828a7fb /source/blender/python/BPY_extern.h | |
parent | f085ebba58d74297e39ff41ad9a3c7a833412571 (diff) |
Fix T66256: Context overrides crash when operators change context
Using context overrides in Python caused problems for any operator that
changed the context and require these changes to be read back.
CTX_wm_area_set() for e.g. would set the struct member but future
calls to CTX_wm_area() would still return the value defined by Python
callers context overrides.
This also resolves a mismatch between polling and calling operators
from Python, where poll would override the Python context where calling
only overrode the context when a new context was passed in.
Diffstat (limited to 'source/blender/python/BPY_extern.h')
-rw-r--r-- | source/blender/python/BPY_extern.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index e1e0d01055a..6632f9ae3cd 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -88,6 +88,16 @@ int BPY_context_member_get(struct bContext *C, void BPY_context_set(struct bContext *C); void BPY_context_update(struct bContext *C); +#define BPY_context_dict_clear_members(C, ...) \ + BPY_context_dict_clear_members_array(&((C)->data.py_context), \ + (C)->data.py_context_orig, \ + ((const char *[]){__VA_ARGS__}), \ + VA_NARGS_COUNT(__VA_ARGS__)) +void BPY_context_dict_clear_members_array(void **dict_p, + void *dict_orig, + const char *context_members[], + uint context_members_len); + void BPY_id_release(struct ID *id); bool BPY_string_is_keyword(const char *str); |