[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13856] trunk/blender/source/blender/ python/api2_2x/Draw.c: == BPython ==

Willian Padovani Germano wpgermano at gmail.com
Mon Feb 25 02:35:50 CET 2008


Revision: 13856
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13856
Author:   ianwill
Date:     2008-02-25 02:35:50 +0100 (Mon, 25 Feb 2008)

Log Message:
-----------
== BPython ==

[#8354] Blender or Python25.dll crash on... quit, reported by David B. (myvain)

The BPy_FreeButtonsList() function is also called after we call Py_Finalize(). Calling PyGILState_Ensure()/Release() there crashes Blender. Added a test to prevent this, but note that function still runs Python API code to free a buttons list. Doesn't seem to give problems, though. Thanks, David.

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/Draw.c

Modified: trunk/blender/source/blender/python/api2_2x/Draw.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Draw.c	2008-02-24 22:27:40 UTC (rev 13855)
+++ trunk/blender/source/blender/python/api2_2x/Draw.c	2008-02-25 01:35:50 UTC (rev 13856)
@@ -881,13 +881,16 @@
 {
 	/*Clear the list.*/
 	if (M_Button_List) {
-		PyGILState_STATE gilstate = PyGILState_Ensure();
+		PyGILState_STATE gilstate;
+		int py_is_on = Py_IsInitialized();
 
+		if (py_is_on) gilstate = PyGILState_Ensure();
+
 		PyList_SetSlice(M_Button_List, 0, PyList_Size(M_Button_List), NULL);
 		Py_DECREF(M_Button_List);
 		M_Button_List = NULL;
 
-		PyGILState_Release(gilstate);
+		if (py_is_on) PyGILState_Release(gilstate);
 	}
 }
 





More information about the Bf-blender-cvs mailing list