Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Wed, 6 Jun 2018 07:39:35 +0000 (09:39 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 6 Jun 2018 07:39:35 +0000 (09:39 +0200)
1  2 
source/blender/blenkernel/intern/blender_undo.c

index 371d9dff8d5ef87ad6e1b8afd69e2101e5e347f2,df2caba0208b03c570293e40a8f1486d211b0df2..857fc72672ca64078773a73a9517ef6fc8d79a8f
  #include "BKE_blendfile.h"
  #include "BKE_appdir.h"
  #include "BKE_context.h"
 -#include "BKE_depsgraph.h"
  #include "BKE_global.h"
  #include "BKE_main.h"
  
  #include "BLO_undofile.h"
  #include "BLO_writefile.h"
  
 +#include "DEG_depsgraph.h"
 +
  /* -------------------------------------------------------------------- */
  
  /** \name Global Undo
@@@ -83,13 -82,14 +83,14 @@@ bool BKE_memfile_undo_decode(MemFileUnd
                success = BKE_blendfile_read_from_memfile(C, &mfu->memfile, NULL, 0);
        }
  
-       /* restore */
-       BLI_strncpy(bmain->name, mainstr, sizeof(bmain->name)); /* restore */
+       /* Restore, bmain has been re-allocated. */
+       bmain = CTX_data_main(C);
+       BLI_strncpy(bmain->name, mainstr, sizeof(bmain->name));
        G.fileflags = fileflags;
  
        if (success) {
                /* important not to update time here, else non keyed tranforms are lost */
-               DEG_on_visible_update(G.main, false);
 -              DAG_on_visible_update(bmain, false);
++              DEG_on_visible_update(bmain, false);
        }
  
        return success;