Fix T70074: Missing file execute region in some files (crashes)

I'm not sure how a .blend file could get into this state, but apparently
for some files saved with versions of Blender after the file browser
changes, the execute region would not have been created. File browser
code assumes this region to be there however.
Luckily I found a file with which I could recreate the issue. My guess
is that the error only happens with files that were stored before
certain versioning fixes were done after the file browser redesign.

To fix this, we just let the versioning code for the execute region run
even with newest files. We can run this safely, it only acts if the
execute region actually doesn't exist.
This commit is contained in:
Julian Eisel 2019-09-19 17:53:19 +02:00
parent 5883b6fde2
commit ee12af9c97
Notes: blender-bot 2023-03-24 17:05:22 +01:00
Referenced by issue #70074, File Browser in Fullscreen crashes Blender
1 changed files with 13 additions and 10 deletions

View File

@ -3779,7 +3779,6 @@ 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);
@ -3796,15 +3795,6 @@ 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;
}
@ -3887,6 +3877,19 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
else if (sl->spacetype == SPACE_FILE) {
ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
ARegion *ar_execute = do_versions_find_region_or_null(regionbase, RGN_TYPE_EXECUTE);
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;
}
}
}
}
}