Fix T48700: Crash when window creation fails

Check if Python is initialized before calling BPY_python_end.
This commit is contained in:
Campbell Barton 2016-06-22 03:29:25 +10:00
parent 028ba31903
commit e783fddc01
Notes: blender-bot 2023-02-14 09:02:40 +01:00
Referenced by issue #48700, Segfault when starting blender
1 changed files with 1 additions and 1 deletions

View File

@ -533,7 +533,7 @@ void WM_exit_ext(bContext *C, const bool do_python)
#ifdef WITH_PYTHON
/* option not to close python so we can use 'atexit' */
if (do_python) {
if (do_python && ((C == NULL) || CTX_py_init_get(C))) {
/* XXX - old note */
/* before BKE_blender_free so py's gc happens while library still exists */
/* needed at least for a rare sigsegv that can happen in pydrivers */