diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-08-23 20:03:12 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-08-23 20:03:12 +0400 |
commit | 008a6cc1eccc9996978321a6abe9e53964a79368 (patch) | |
tree | e8fb9fa1f3720e0b0276d43219b0fb00624898db | |
parent | a1d560fc899df335f11ff5382359f431f8f835a2 (diff) |
Fixed a bug in PythonInterpreter::interpretFile() that a temporary
text object storing a Python script was not properly freed when an
error occurred during the execution of the script.
-rwxr-xr-x | source/blender/freestyle/intern/system/PythonInterpreter.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h index 4784f1ea96a..fa796630b9a 100755 --- a/source/blender/freestyle/intern/system/PythonInterpreter.h +++ b/source/blender/freestyle/intern/system/PythonInterpreter.h @@ -77,16 +77,18 @@ class LIB_SYSTEM_EXPORT PythonInterpreter : public Interpreter cout << "couldn't create Blender text from" << fn << endl; } - if (BPY_txt_do_python_Text(text) != 1) { + int status = BPY_txt_do_python_Text(text); + + // cleaning up + unlink_text(text); + free_libblock(&G.main->text, text); + + if (status != 1) { cout << "\nError executing Python script from PythonInterpreter::interpretFile:" << endl; cout << fn << " (at line " << BPY_Err_getLinenumber() << ")" << endl; return BPY_Err_getLinenumber(); } - // cleaning up - unlink_text(text); - free_libblock(&G.main->text, text); - return 0; } |