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.
This commit is contained in:
2020-09-17 18:23:12 +10:00
parent f085ebba58
commit 76f99bd13a
5 changed files with 141 additions and 17 deletions

View File

@@ -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);