Page MenuHome

Fix T79931: Infinite loop in scene "Full Copy" in 2.90.
ClosedPublic

Authored by Bastien Montagne (mont29) on Aug 20 2020, 11:23 AM.

Details

Summary

Code dealing with object copy of master collection was bugy in case one
of the new object copy would get a name lesser than the original object,
leading to new copy being inserted before original one in lists.

Critical fix for 2.90, have to double-check if this is also relevant for 2.83...

Diff Detail

Repository
rB Blender

Event Timeline

Bastien Montagne (mont29) requested review of this revision.Aug 20 2020, 11:23 AM
Bastien Montagne (mont29) created this revision.

have to double-check if this is also relevant for 2.83...

ellipsis - the omission from speech or writing of a word or words that are superfluous or able to be understood from contextual clues.

I do not see how there could be anything superfluous, and not able to to understand from the context what is it you are hiding behind the ellipsis.

If you are using ellipsis just because you like it so much, please don't, as it has quite clear commonly agreed on semantics. It is always a good idea to be explicit when sharing your work with others.

On the actual code note, am I right that the root of the issue comes from there lines:

collection_object_add(bmain, collection_new, ob_new, 0, true);
collection_object_remove(bmain, collection_new, ob_old, false);

If so, it seems cleaner, more reliable, more clear to split loops in a way that first one does BKE_object_duplicate and second one does the add/remove, regardless of whether this is a main collection or not.

Ideally would happen in separate functions, perfectly following "one function does one thing" rule.

Wanted to keep the double-loop only for master case... But probably not worth of an optimization indeed.

the rest of that comment I find fully superfluous tbh. Don't see the pint in making noise for making noise, especially about a review comment.

Always use two loops now.

source/blender/blenkernel/intern/collection.c
411–413

Since this is not done for master collection exclusively, better comment would be something like this:

Duplicate objects and manipulate their pretense in the collection in two different loops. This avoids an infinite loop when duplicating object places it at the end of the collection, which makes the loop visit it again and a again.
424–425

Is this still relevant?

This revision is now accepted and ready to land.Aug 20 2020, 5:34 PM

Logic looks correct to me, will leave discussion about clarifying comments to you guys.

source/blender/blenkernel/intern/collection.c
411–413

Good point.

424–425

Yes, we are still modifying the listbase we are looping on in case of master collection.

Don't see the point in making noise for making noise

Please see the point about minimizing ambiguity, increasing clarity, and reduced syntax noise for people who are reading your thoughts which you put in words.

Especially about a review comment

That specific review comment was absolutely unclear. Is it a task to be done now? before commit? After the commit? Is it expected for someone else to be responsible for it?

Bastien Montagne (mont29) added a commit: rB05e1ccf10836: Fix T79931: Infinite loop in scene "Full Copy" in 2.90.

This is not how the code review process work. You can't just abort the review in its very middle and commit it in an unknown to reviewers state.
Replying in the review after the commit was done is even more weird.