diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-01 05:54:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-01 05:54:29 +0300 |
commit | b17bbf9d9548a608d865a25c629e142f12ce762a (patch) | |
tree | eeba3478ada3f0d10c20774e57b2fe1e9a18c6f1 /source/blender/python/intern/bpy_operator.c | |
parent | 339d3bf05f6b34064ed9e0c5016b315e0a1e5cf9 (diff) |
fix for 2 segfaults running in background mode.
- operators which reload G.main would crash blender if called from python and then accessed bpy.data.*
- WM_read_homefile_exec was setting the contexts Scene to NULL as a signal for the event system, this didnt work in background mode, crashing when property update functions expected scene to be set.
Diffstat (limited to 'source/blender/python/intern/bpy_operator.c')
-rw-r--r-- | source/blender/python/intern/bpy_operator.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 2130dd60f12..70aa46c1302 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -231,6 +231,12 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) return NULL; } + /* when calling bpy.ops.wm.read_factory_settings() bpy.data's main pointer is freed by clear_globals(), + * further access will crash blender. setting context is not needed in this case, only calling because this + * function corrects bpy.data (internal Main pointer) */ + BPY_modules_update(C); + + /* return operator_ret as a bpy enum */ return pyrna_enum_bitfield_to_py(operator_return_items, operator_ret); |