[Bf-blender-cvs] [ee12af9c97f] master: Fix T70074: Missing file execute region in some files (crashes)

Julian Eisel noreply at git.blender.org
Thu Sep 19 18:30:05 CEST 2019


Commit: ee12af9c97f79d6229857690c91e5017b7683aec
Author: Julian Eisel
Date:   Thu Sep 19 17:53:19 2019 +0200
Branches: master
https://developer.blender.org/rBee12af9c97f79d6229857690c91e5017b7683aec

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.

===================================================================

M	source/blender/blenloader/intern/versioning_280.c

===================================================================

diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 074809d10c4..aa54e64cd6b 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -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;
+            }
+          }
         }
       }
     }



More information about the Bf-blender-cvs mailing list