bugfix [#19392] Typing help() in the console window freezes Blender
authorCampbell Barton <ideasman42@gmail.com>
Mon, 21 Sep 2009 12:23:56 +0000 (12:23 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 21 Sep 2009 12:23:56 +0000 (12:23 +0000)
for now set the sys.stdin to None, this gives an error on input() or help() but better then locking up blender.
Would be nice to support for the blender console to be used as a stdin but this isnt so simple.

also quiet some warnings.

source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/space_file.c
source/blender/editors/transform/transform_input.c
source/blender/python/intern/bpy_interface.c

index 7839cf5bf4bd906bd754e8f70a57a678ba342426..c717623696a735c636cc9eef9cce609b09351f4b 100644 (file)
@@ -72,7 +72,6 @@ static int find_file_mouse(SpaceFile *sfile, struct ARegion* ar, short x, short
 {
        float fx,fy;
        int active_file = -1;
-       int numfiles = filelist_numfiles(sfile->files);
        View2D* v2d = &ar->v2d;
 
        UI_view2d_region_to_view(v2d, x, y, &fx, &fy);
index 56dbdcbc645dae6cc58c87c1904f3227f968eb0e..ca2c145c52b82a5aaceb869d3d531afbd15b5506 100644 (file)
@@ -155,7 +155,7 @@ static void file_free(SpaceLink *sl)
 /* spacetype; init callback, area size changes, screen set, etc */
 static void file_init(struct wmWindowManager *wm, ScrArea *sa)
 {
-       SpaceFile *sfile= (SpaceFile*)sa->spacedata.first;
+       //SpaceFile *sfile= (SpaceFile*)sa->spacedata.first;
        printf("file_init\n");
 }
 
index e1e4569623b2fcacdb366b6d9b049fe8d37ebf83..83d4a314057bf98ccbc298693820db1c6685827f 100644 (file)
@@ -34,7 +34,7 @@
 
 #include "transform.h"
 
-
+#include "MEM_guardedalloc.h" 
 
 /* ************************** INPUT FROM MOUSE *************************** */
 
index fd8cfc47f5568d5751dc82129097b5460ff8f156..3e28bc7968f931a40ba56efa013aa9aa84d8a10b 100644 (file)
@@ -292,6 +292,11 @@ void BPY_start_python( int argc, char **argv )
                PyObject *d = PyEval_GetBuiltins(  );
                PyDict_SetItemString(d, "reload",               item=PyCFunction_New(bpy_reload_meth, NULL));   Py_DECREF(item);
                PyDict_SetItemString(d, "__import__",   item=PyCFunction_New(bpy_import_meth, NULL));   Py_DECREF(item);
+               
+               /* a bit nasty but this prevents help() and input() from locking blender
+                * Ideally we could have some way for the console to replace sys.stdin but
+                * python would lock blender while waiting for a return value, not easy :| */
+               PySys_SetObject("stdin", Py_None);
        }
        
        pyrna_alloc_types();