diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-12 17:31:07 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-12 17:36:07 +0300 |
commit | 914f4308fb828941436c1ecfb4a58b18017fbd1c (patch) | |
tree | d7ce8ef618b06ce1b5cdf093b56fa2726463d290 | |
parent | 52b32fde187b9817b2f8f9c7741a9a2147a3db3a (diff) |
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).
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 2615c17ace5..e9b4650d7d6 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -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; } |