[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34121] trunk/blender/source: bugfix [ #25488] Game engine crash when try to run after blender app start

Campbell Barton ideasman42 at gmail.com
Thu Jan 6 06:04:07 CET 2011


Revision: 34121
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34121
Author:   campbellbarton
Date:     2011-01-06 06:04:07 +0100 (Thu, 06 Jan 2011)

Log Message:
-----------
bugfix [#25488] Game engine crash when try to run after blender app start
- also found other places where utf8 isnt ensured.
- remove duplicate NULL checks in object_edit.c

Modified Paths:
--------------
    trunk/blender/source/blender/editors/object/object_edit.c
    trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp

Modified: trunk/blender/source/blender/editors/object/object_edit.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_edit.c	2011-01-06 05:03:26 UTC (rev 34120)
+++ trunk/blender/source/blender/editors/object/object_edit.c	2011-01-06 05:04:07 UTC (rev 34121)
@@ -523,11 +523,11 @@
 	/* covers proxies too */
 	if(ELEM(NULL, ob, ob->data) || ((ID *)ob->data)->lib)
 		return 0;
-	
-	if (ob && (ob->restrictflag & OB_RESTRICT_VIEW))
+
+	if (ob->restrictflag & OB_RESTRICT_VIEW)
 		return 0;
 
-	return ob && (ob->type == OB_MESH || ob->type == OB_ARMATURE ||
+	return (ob->type == OB_MESH || ob->type == OB_ARMATURE ||
 			  ob->type == OB_FONT || ob->type == OB_MBALL ||
 			  ob->type == OB_LATTICE || ob->type == OB_SURF ||
 			  ob->type == OB_CURVE);

Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp	2011-01-06 05:03:26 UTC (rev 34120)
+++ trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp	2011-01-06 05:04:07 UTC (rev 34121)
@@ -232,7 +232,7 @@
 
 	BLI_strncpy(expanded, filename, FILE_MAXDIR + FILE_MAXFILE);
 	BLI_path_abs(expanded, gp_GamePythonPath);
-	return PyUnicode_FromString(expanded);
+	return PyUnicode_DecodeFSDefault(expanded);
 }
 
 static char gPyStartGame_doc[] =
@@ -498,7 +498,7 @@
 	
     while ((dirp = readdir(dp)) != NULL) {
 		if (BLI_testextensie(dirp->d_name, ".blend")) {
-			value = PyUnicode_FromString(dirp->d_name);
+			value= PyUnicode_DecodeFSDefault(dirp->d_name);
 			PyList_Append(list, value);
 			Py_DECREF(value);
 		}
@@ -1826,7 +1826,7 @@
 	BLI_split_dirfile(filename, expanded, NULL); /* get the dir part of filename only */
 	BLI_path_abs(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */
 	BLI_cleanup_file(gp_GamePythonPath, expanded); /* Dont use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */
-	item= PyUnicode_FromString(expanded);
+	item= PyUnicode_DecodeFSDefault(expanded);
 	
 //	printf("SysPath - '%s', '%s', '%s'\n", expanded, filename, gp_GamePythonPath);
 	
@@ -1917,7 +1917,7 @@
 		PyObject *py_argv= PyList_New(argc);
 
 		for (i=0; i<argc; i++)
-			PyList_SET_ITEM(py_argv, i, PyUnicode_FromString(argv[i]));
+			PyList_SET_ITEM(py_argv, i, PyC_UnicodeFromByte(argv[i]));
 
 		PySys_SetObject("argv", py_argv);
 		Py_DECREF(py_argv);





More information about the Bf-blender-cvs mailing list