diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-06-15 05:50:08 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-06-15 05:52:59 +0300 |
commit | 2ba804d7b7dc9612540ff0d15a89cc1fc8c0bffa (patch) | |
tree | 6d2aaf2ec1d0fd43010ba7bead88914a8bd935ca /source/blender/blenkernel | |
parent | 5dc0fd08a70b123e5d17057e1cbc1462bef0d8d8 (diff) |
Screen: clear runtime structures on file-read & data-copy
Clear the runtime data structs instead of individual members,
this simplifies adding new runtime members as there are at least
two places they would need to be cleared.
Resolves error in D8883.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/screen.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index d0d63192ebf..2d59e978a81 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -467,7 +467,7 @@ static void panel_list_copy(ListBase *newlb, const ListBase *lb) Panel *panel = lb->first; for (; new_panel; new_panel = new_panel->next, panel = panel->next) { new_panel->activedata = NULL; - new_panel->runtime.custom_data_ptr = NULL; + memset(&new_panel->runtime, 0x0, sizeof(new_panel->runtime)); panel_list_copy(&new_panel->children, &panel->children); } } @@ -476,6 +476,8 @@ ARegion *BKE_area_region_copy(const SpaceType *st, const ARegion *region) { ARegion *newar = MEM_dupallocN(region); + memset(&newar->runtime, 0x0, sizeof(newar->runtime)); + newar->prev = newar->next = NULL; BLI_listbase_clear(&newar->handlers); BLI_listbase_clear(&newar->uiblocks); @@ -1419,6 +1421,8 @@ static void direct_link_panel_list(BlendDataReader *reader, ListBase *lb) static void direct_link_region(BlendDataReader *reader, ARegion *region, int spacetype) { + memset(®ion->runtime, 0x0, sizeof(region->runtime)); + direct_link_panel_list(reader, ®ion->panels); BLO_read_list(reader, ®ion->panels_category_active); @@ -1560,16 +1564,15 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area) if (sl->spacetype == SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; + + memset(&v3d->runtime, 0x0, sizeof(v3d->runtime)); + if (v3d->gpd) { BLO_read_data_address(reader, &v3d->gpd); BKE_gpencil_blend_read_data(reader, v3d->gpd); } BLO_read_data_address(reader, &v3d->localvd); - /* Runtime data */ - v3d->runtime.properties_storage = NULL; - v3d->runtime.flag = 0; - /* render can be quite heavy, set to solid on load */ if (v3d->shading.type == OB_RENDER) { v3d->shading.type = OB_SOLID; @@ -1584,7 +1587,7 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area) SpaceGraph *sipo = (SpaceGraph *)sl; BLO_read_data_address(reader, &sipo->ads); - BLI_listbase_clear(&sipo->runtime.ghost_curves); + memset(&sipo->runtime, 0x0, sizeof(sipo->runtime)); } else if (sl->spacetype == SPACE_NLA) { SpaceNla *snla = (SpaceNla *)sl; @@ -1652,7 +1655,7 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area) } else if (sl->spacetype == SPACE_TEXT) { SpaceText *st = (SpaceText *)sl; - memset(&st->runtime, 0, sizeof(st->runtime)); + memset(&st->runtime, 0x0, sizeof(st->runtime)); } else if (sl->spacetype == SPACE_SEQ) { SpaceSeq *sseq = (SpaceSeq *)sl; @@ -1724,6 +1727,11 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area) BLO_read_data_address(reader, &sfile->params); BLO_read_data_address(reader, &sfile->asset_params); } + else if (sl->spacetype == SPACE_ACTION) { + SpaceAction *saction = (SpaceAction *)sl; + + memset(&saction->runtime, 0x0, sizeof(saction->runtime)); + } else if (sl->spacetype == SPACE_CLIP) { SpaceClip *sclip = (SpaceClip *)sl; |