Fix T69791: Fix crash reading old file browser in temporary window

When reading a old .blend file (from before the new file browser
design), we wouldn't create the execute region for existing file
editors. This usually wasn't an issue, but it could become one when a
file browser was opened in a temporary screen before, and that screen
was still visible. Then code spawning the new file browser would re-use
the old file browser data, assuming the execute region was there.

Handle this in versioning code and let rest of the code keep sane
assumtions (e.g. that there always is a execute region, even if
invisible).
This commit is contained in:
Julian Eisel
2019-09-12 16:31:07 +02:00
parent 52b32fde18
commit 914f4308fb

View File

@@ -3777,6 +3777,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
ARegion *ar_header = do_versions_find_region(regionbase, RGN_TYPE_HEADER);
ARegion *ar_toolprops = do_versions_find_region_or_null(regionbase,
RGN_TYPE_TOOL_PROPS);
ARegion *ar_execute = do_versions_find_region_or_null(regionbase, RGN_TYPE_EXECUTE);
/* Reinsert UI region so that it spawns entire area width */
BLI_remlink(regionbase, ar_ui);
@@ -3793,6 +3794,15 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
BLI_freelinkN(regionbase, ar_toolprops);
}
if (!ar_execute) {
ARegion *ar_main = do_versions_find_region(regionbase, RGN_TYPE_WINDOW);
ar_execute = MEM_callocN(sizeof(ARegion), "versioning execute region for file");
BLI_insertlinkbefore(regionbase, ar_main, ar_execute);
ar_execute->regiontype = RGN_TYPE_EXECUTE;
ar_execute->alignment = RGN_ALIGN_BOTTOM;
ar_execute->flag |= RGN_FLAG_DYNAMIC_SIZE;
}
if (sfile->params) {
sfile->params->details_flags |= FILE_DETAILS_SIZE | FILE_DETAILS_DATETIME;
}