From 723397bb91d00aeb625769084cef159ba7794048 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 28 Apr 2008 21:54:03 +0000 Subject: [PATCH] running scripts in background mode would crash blender when checking a scriptspace areas --- source/blender/python/BPY_interface.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index 5858b933562..86bcd51e914 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -639,11 +639,13 @@ int BPY_txt_do_python_Text( struct Text *text ) if( !strcmp( script->id.name + 2, text->id.name + 2 ) ) { /* if this text is already a running script, * just move to it: */ - SpaceScript *sc; - newspace( curarea, SPACE_SCRIPT ); - sc = curarea->spacedata.first; - sc->script = script; - return 1; + if (!G.background) { + SpaceScript *sc; + newspace( curarea, SPACE_SCRIPT ); + sc = curarea->spacedata.first; + sc->script = script; + return 1; + } } script = script->id.next; } @@ -943,10 +945,12 @@ int BPY_run_script(Script *script) /* special case: called from the menu in the Scripts window * we have to change sc->script pointer, since it'll be freed here.*/ - if( curarea->spacetype == SPACE_SCRIPT ) { - SpaceScript *sc = curarea->spacedata.first; - sc->script = G.main->script.first; /* can be null, which is ok ... */ - /* ... meaning no other script is running right now. */ + if (!G.background) { + if( curarea->spacetype == SPACE_SCRIPT ) { + SpaceScript *sc = curarea->spacedata.first; + sc->script = G.main->script.first; /* can be null, which is ok ... */ + /* ... meaning no other script is running right now. */ + } } }