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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-16 19:15:40 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-11-16 19:15:40 +0400
commitcf64a5b622151dbcfd7162e7ee93fd7afc88b24f (patch)
treef5f1fc5301ed7857f25bbd9bc51393eece1f4832 /source/blender/blenkernel/intern/context.c
parentd017f34c5dda6f0940c0ba13271113881b7108b5 (diff)
Python/Context: do not allow any UI context access from threads like render
or baking. This basically means you will only have access to bpy.data and bpy.context.scene, not current window, active object, etc, as those are not thread safe anyway and were likely to cause issues already. This fixes #30858, where the UI would lose buttons due to context getting corrupted when editing objects in pre/post render or using luxrender. The context access they did (indirectly) was only using the current scene or data so they still work.
Diffstat (limited to 'source/blender/blenkernel/intern/context.c')
-rw-r--r--source/blender/blenkernel/intern/context.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 719ae7357b4..ffb93139358 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -44,6 +44,7 @@
#include "BLI_listbase.h"
#include "BLI_string.h"
+#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -245,6 +246,10 @@ static void *ctx_wm_python_context_get(const bContext *C, const char *member, vo
(void)C, (void)member;
#endif
+ /* don't allow UI context access from non-main threads */
+ if (!BLI_thread_is_main())
+ return NULL;
+
return fall_through;
}
@@ -264,6 +269,11 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
// return 1;
}
#endif
+
+ /* don't allow UI context access from non-main threads */
+ if (!BLI_thread_is_main())
+ return done;
+
/* we check recursion to ensure that we do not get infinite
* loops requesting data from ourselfs in a context callback */