Page MenuHome

Fix crash loading file saved with recent master in old versions
ClosedPublic

Authored by Julian Eisel (Severin) on Nov 3 2020, 8:52 PM.

Details

Summary

Since enabling global area writing (ef4aa42ea4ff), loading a file in old
Blender versions would cause wmWindow.global_areas to be read, since there
was already reading code for it and ScrAreaMap was in SDNA.
However the ScrArea.global of the global areas would be NULL, because it
was *not* in SDNA (ScrGlobalAreaData was excluded).
The code however assumes that areas in the global area-map have a valid
ScrArea.global pointer.

Think this was a mistake in rB5f6c45498c92. We should have cleared all this data
on reading, until the global area writing was enabled.

Diff Detail

Repository
rB Blender
Branch
master
Build Status
Buildable 11086
Build 11086: arc lint + arc unit

Event Timeline

Julian Eisel (Severin) requested review of this revision.Nov 3 2020, 8:52 PM

I'm a bit confused here... Also would not mind having @Brecht Van Lommel (brecht) or @Campbell Barton (campbellbarton) thoughts on this.

If I understand this patch correctly, you force storing that value in .blend files under a 'false' name that is not even used at all in Blender? I would rather avoid that tbh...

At the very least, I would rename the variable in DNA struct to match new name then - yes, it will be a noisy commit, but at least consistency between current codebase and .blend files it produces would be kept?

Is there no more straightforward solution to this, like clearing the pointer on old files or changing the name?

Is there no more straightforward solution to this, like clearing the pointer on old files or changing the name?

How could we clear the pointer? Old versions (since 2.80) didn't clear this, which was the initial mistake, but we'd have to do it on read.

Changing the name is possible, but I'd prefer to keep the current name. That's why I first went for this proposal to just rename it in SDNA.
I actually do think this is a straightforward solution, it's just that the initial problem is a bit difficult to grasp. (Maybe the code comment should be shorter and just reference the task/diff to avoid confusion.)

If I understand this patch correctly, you force storing that value in .blend files under a 'false' name that is not even used at all in Blender? I would rather avoid that tbh...

That's how the renaming code works. DNA still stores the old names (e.g. bTheme.toops) that are not used at all in current Blender. But when reading it, DNA maps it to the new name as an alias (e.g. bTheme.space_outliner).

Ok, I understand the issue now. This fix seems ok then, but this description would have been more clear to me:

Write with a different name, old Blender versions crash loading files with non-NULL global_areas.
This revision is now accepted and ready to land.Nov 4 2020, 7:26 PM