Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-08-07 20:20:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-08-07 20:20:19 +0400
commit70f011bbcea9aee222e43895fea503b26d3d566a (patch)
tree829ba8d75f662c5a49369e05aa0876adec3a9e9e /source/blender/python/intern/bpy_operator_wrap.c
parentce273aee084fd367245d20a15b307d4ad99584d8 (diff)
bpy_context_set and bpy_context_clear to replace a number of functions (some were not always called causing bugs).
fix for a leak when trying to run a text with a syntax error too.
Diffstat (limited to 'source/blender/python/intern/bpy_operator_wrap.c')
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 080d2e8ce6a..7a92c747bd3 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -93,11 +93,9 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
PointerRNA ptr_event;
PyObject *py_operator;
- PyGILState_STATE gilstate = PyGILState_Ensure();
+ PyGILState_STATE gilstate;
- bpy_import_main_set(CTX_data_main(C));
-
- BPY_update_modules(); // XXX - the RNA pointers can change so update before running, would like a nicer solutuon for this.
+ bpy_context_set(C, &gilstate);
args = PyTuple_New(1);
PyTuple_SET_ITEM(args, 0, PyObject_GetAttrString(py_class, "__rna__")); // need to use an rna instance as the first arg
@@ -221,8 +219,7 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
}
#endif
- PyGILState_Release(gilstate);
- bpy_import_main_set(NULL);
+ bpy_context_clear(C, &gilstate);
return ret_flag;
}