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:
authorBastien Montagne <montagne29@wanadoo.fr>2019-03-05 16:06:19 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-03-05 16:09:18 +0300
commit8b10e1b45798b39fd63adef65f2eae0c7fbadbac (patch)
treeae443c240e849c59ad2303ad5c011f9e244603dc /source/blender/makesrna
parent6e95d8484caf5cd5c6b9e34ce662516e0e78ee88 (diff)
Fix T61780: Crash when trying to access screen areas through the outliner.
ScreenArea->type is NULL-ified on read, and need to be initialized (usually by `ED_area_initialize()`), but RNA can also access it before it happens, so need to do it itself...
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_screen.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index 095aab53c10..0f363810ed2 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -256,6 +256,16 @@ static int rna_Area_ui_type_get(PointerRNA *ptr)
{
int value = rna_Area_type_get(ptr) << 16;
ScrArea *sa = ptr->data;
+ /* sa->type can be NULL (when not yet initialized), try to do it now. */
+ /* Copied from `ED_area_initialize()`.*/
+ if (sa->type == NULL) {
+ sa->type = BKE_spacetype_from_id(sa->spacetype);
+ if (sa->type == NULL) {
+ sa->spacetype = SPACE_VIEW3D;
+ sa->type = BKE_spacetype_from_id(sa->spacetype);
+ }
+ BLI_assert(sa->type != NULL);
+ }
if (sa->type->space_subtype_item_extend != NULL) {
value |= sa->type->space_subtype_get(sa);
}