Fix T69974: crashes in .blend files where 3D viewport was split
This was caused by a missing copy of the recently adding 3D viewport shading ID properties.
This commit is contained in:
parent
df5fae1fcc
commit
6ee2d10005
Notes:
blender-bot
2023-02-14 05:51:15 +01:00
Referenced by issue #69974, faulty .blend file causes crash when creating new scene, reverting, opening file and even closing Blender
|
@ -318,6 +318,10 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
|
|||
flag_subdata);
|
||||
}
|
||||
|
||||
if (sce_src->display.shading.prop) {
|
||||
sce_dst->display.shading.prop = IDP_CopyProperty(sce_src->display.shading.prop);
|
||||
}
|
||||
|
||||
BKE_sound_reset_scene_runtime(sce_dst);
|
||||
|
||||
/* Copy sequencer, this is local data! */
|
||||
|
|
|
@ -3856,7 +3856,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
|
||||
{
|
||||
/* Versioning code until next subversion bump goes here. */
|
||||
|
||||
if (!DNA_struct_elem_find(
|
||||
fd->filesdna, "LayerCollection", "short", "local_collections_bits")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
|
@ -3867,5 +3866,29 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix wrong 3D viewport copying causing corrupt pointers (T69974). */
|
||||
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
|
||||
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
|
||||
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d = (View3D *)sl;
|
||||
|
||||
for (ScrArea *sa_other = screen->areabase.first; sa_other; sa_other = sa_other->next) {
|
||||
for (SpaceLink *sl_other = sa_other->spacedata.first; sl_other;
|
||||
sl_other = sl_other->next) {
|
||||
if (sl != sl_other && sl_other->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d_other = (View3D *)sl_other;
|
||||
|
||||
if (v3d->shading.prop == v3d_other->shading.prop) {
|
||||
v3d_other->shading.prop = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -345,6 +345,10 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
|
|||
v3dn->shading.type = OB_SOLID;
|
||||
}
|
||||
|
||||
if (v3dn->shading.prop) {
|
||||
v3dn->shading.prop = IDP_CopyProperty(v3do->shading.prop);
|
||||
}
|
||||
|
||||
/* copy or clear inside new stuff */
|
||||
|
||||
v3dn->runtime.properties_storage = NULL;
|
||||
|
|
Loading…
Reference in New Issue