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/blenkernel/BKE_context.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/blenkernel/BKE_context.h')
-rw-r--r-- | source/blender/blenkernel/BKE_context.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index ef6c36a9730..f3e4a18b9bd 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -138,7 +138,14 @@ bool CTX_py_init_get(bContext *C); void CTX_py_init_set(bContext *C, bool value); void *CTX_py_dict_get(const bContext *C); -void CTX_py_dict_set(bContext *C, void *value); +void *CTX_py_dict_get_orig(const bContext *C); + +struct bContext_PyState { + void *py_context; + void *py_context_orig; +}; +void CTX_py_state_push(bContext *C, struct bContext_PyState *pystate, void *value); +void CTX_py_state_pop(bContext *C, struct bContext_PyState *pystate); /* Window Manager Context */ |