[Bf-blender-cvs] [2737bcd47b6] undo-experiments-idnames: Change message in case of pointer collision to always print.

Bastien Montagne noreply at git.blender.org
Thu Jan 9 11:25:50 CET 2020


Commit: 2737bcd47b66fd88f4ffe5811807c7b1507462f2
Author: Bastien Montagne
Date:   Tue Jan 7 15:25:14 2020 +0100
Branches: undo-experiments-idnames
https://developer.blender.org/rB2737bcd47b66fd88f4ffe5811807c7b1507462f2

Change message in case of pointer collision to always print.

It is very difficult to test that code, as pointer collisions are
expected to be rather rare... So for now systematically print when we
detect one, could be at least a useful hint in bug report.

And some more comments.

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

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

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index e85e4d32677..2984e690e1f 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -10093,19 +10093,25 @@ static void blo_undo_merge_and_fix_collisions_in_libmaps(FileData *fd)
            oldp = (const char *)oldp + 1)
         ;
 
-      DEBUG_PRINTF(
+      printf(
           "%s: found same old pointer value used by both re-used IDs and newly read-from-memfile "
           "IDs, remapped the laters from %p to %p\n",
           __func__,
           orig_oldp,
           oldp);
+      printf("%s: Nothing to worry about, unless this leads to a crash!\n", __func__);
 
       /* Now we need to remap all orig_oldp pointers in local main to the new oldp value. */
+      /* Note that we are not using regular ID remapping API, since we only care about pointer
+       * values here, current bmain is still totally unlinked so all the extra processing would be
+       * useless - and lead to crash. */
       Main *bmain = fd->mainlist->first;
       ID *id;
       const void *old_new_oldpointers[2] = {orig_oldp, oldp};
       FOREACH_MAIN_ID_BEGIN (bmain, id) {
         if (id->tag & LIB_TAG_UNDO_OLD_ID_REUSED) {
+          /* We only want to update values of odl pointers in data read from memfile, not the one
+           * re-used from the old bmain. */
           continue;
         }
         BKE_library_foreach_ID_link(bmain,



More information about the Bf-blender-cvs mailing list