diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-05-08 02:47:35 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-05-08 02:51:40 +0300 |
commit | 2a8ba9c08ec91d73a9c1f59b90aa9e9e37e492d8 (patch) | |
tree | 6dfa7da7de2f37eb20e9bc5b25d201b5493c6d40 /source/blender | |
parent | 7a4e045d8f5f2d0e6e8db872aeb69d4c4b124f2a (diff) |
Fix T76471: timer not removed after changing file browser to another type
The file browser exit() callback was not called. RNA get functions should never
modify data, here the area type info to be changed before the screen and area
were properly updated.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index d9e3003c6f3..20ae69dc031 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -218,18 +218,22 @@ static int rna_Area_ui_type_get(PointerRNA *ptr) const bool area_changing = area->butspacetype != SPACE_EMPTY; int value = area_type << 16; - /* area->type can be NULL (when not yet initialized), try to do it now. */ - /* Copied from `ED_area_initialize()`.*/ - if (area->type == NULL || area_changing) { - area->type = BKE_spacetype_from_id(area_type); - if (area->type == NULL) { - area->spacetype = SPACE_VIEW3D; - area->type = BKE_spacetype_from_id(area->spacetype); + /* Area->type can be NULL when not yet initialized (for example when accessed + * through the outliner or API when not visible), or it can be wrong while + * the area type is changing. + * So manually do the lookup in those cases, but do not actually change area->type + * since that prevents a proper exit when the area type is changing. + * Logic copied from `ED_area_initialize()`.*/ + SpaceType *type = area->type; + if (type == NULL || area_changing) { + type = BKE_spacetype_from_id(area_type); + if (type == NULL) { + type = BKE_spacetype_from_id(SPACE_VIEW3D); } - BLI_assert(area->type != NULL); + BLI_assert(type != NULL); } - if (area->type->space_subtype_item_extend != NULL) { - value |= area_changing ? area->butspacetype_subtype : area->type->space_subtype_get(area); + if (type->space_subtype_item_extend != NULL) { + value |= area_changing ? area->butspacetype_subtype : type->space_subtype_get(area); } return value; } |