Fix T63386: text editor footer added multiple times.
authorGeorge Vogiatzis <Gvgeo>
Mon, 8 Apr 2019 20:35:55 +0000 (22:35 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 8 Apr 2019 20:51:30 +0000 (22:51 +0200)
Differential Revision: https://developer.blender.org/D4663

source/blender/blenkernel/BKE_blender_version.h
source/blender/blenloader/intern/versioning_280.c

index 4c88410..9c47cc9 100644 (file)
@@ -24,7 +24,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         280
-#define BLENDER_SUBVERSION      54
+#define BLENDER_SUBVERSION      55
 /* Several breakages with 280, e.g. collections vs layers */
 #define BLENDER_MINVERSION      280
 #define BLENDER_MINSUBVERSION   0
index 25ada2f..a32ff9f 100644 (file)
@@ -2995,15 +2995,24 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
                }
        }
 
-       {
-               /* Versioning code until next subversion bump goes here. */
-
+       if (!MAIN_VERSION_ATLEAST(bmain, 280, 55)) {
                for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
                        for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
                                for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
                                        if (sl->spacetype == SPACE_TEXT) {
                                                ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
                                                ARegion *ar = MEM_callocN(sizeof(ARegion), "footer for text");
+
+                                               /* Remove multiple footers that were added by mistake. */
+                                               ARegion *ar_footer, *ar_next;
+                                               for (ar_footer = regionbase->first; ar_footer; ar_footer = ar_next) {
+                                                       ar_next = ar_footer->next;
+                                                       if (ar_footer->regiontype == RGN_TYPE_FOOTER) {
+                                                               BLI_freelinkN(regionbase, ar_footer);
+                                                       }
+                                               }
+
+                                               /* Add footer. */
                                                ARegion *ar_header = NULL;
 
                                                for (ar_header = regionbase->first; ar_header; ar_header = ar_header->next) {
@@ -3022,4 +3031,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
                        }
                }
        }
+
+       {
+               /* Versioning code until next subversion bump goes here. */
+       }
 }