Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-09-28 19:42:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-28 19:42:55 +0400
commitb88776ba5a1d58d87b1a70ed73337c2e04e068f8 (patch)
treebe72e48c94a71f2ea9218242fc3890dedb45607a /source/blender/python
parent35f881b44dfed78290770f929405b63f480d78cb (diff)
fix for crash with demo mode addon, modal operator loading a blend file would free all window data which was then accessed, causing a crash.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_rna.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index cbd6affb117..271e4c72a25 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -6238,7 +6238,11 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
ParameterIterator iter;
PointerRNA funcptr;
int err= 0, i, flag, ret_len=0;
- int is_static= RNA_function_flag(func) & FUNC_NO_SELF;
+ const char is_static= (RNA_function_flag(func) & FUNC_NO_SELF) != 0;
+
+ /* annoying!, need to check if the screen gets set to NULL which is a
+ * hint that the file was actually re-loaded. */
+ const char is_valid_screen= (CTX_wm_screen(C) != NULL);
PropertyRNA *pret_single= NULL;
void *retdata_single= NULL;
@@ -6498,7 +6502,11 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
if(err != 0) {
ReportList *reports;
/* alert the user, else they wont know unless they see the console. */
- if (!is_static && ptr->data && RNA_struct_is_a(ptr->type, &RNA_Operator)) {
+ if ( (!is_static) &&
+ (ptr->data) &&
+ (RNA_struct_is_a(ptr->type, &RNA_Operator)) &&
+ is_valid_screen == (CTX_wm_screen(C) != NULL))
+ {
wmOperator *op= ptr->data;
reports= op->reports;
}