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...
This commit is contained in:
parent
6e95d8484c
commit
8b10e1b457
Notes:
blender-bot
2023-02-14 11:29:52 +01:00
Referenced by issue #76471, Crash on BLI_assert(sfile->previews_timer == NULL); Referenced by issue #61780, Crash when trying to access screen areas through the outliner
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue