Page MenuHome

Curves: Move constructor/assignment
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Mar 10 2022, 6:33 PM.

Details

Summary

Add the ability to move CurvesGeometry without copying its attributes and data.
The source is left in an empty but valid state. A test file is added to test the move
constructor.

Diff Detail

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Mar 10 2022, 6:33 PM
Hans Goudey (HooglyBoogly) created this revision.
Hans Goudey (HooglyBoogly) retitled this revision from Curves: Move constructor/assignment (WIP) to Curves: Move constructor/assignment.
Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)

Fix state of source after move

source/blender/blenkernel/intern/curves_geometry.cc
91

we just do a shallow swap of the entire CurvesGeometry instead of swapping the individual elements?

  • Use std::swap on the whole struct rather than individual members
Jacques Lucke (JacquesLucke) requested changes to this revision.Mar 11 2022, 1:06 PM
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/blenkernel/intern/curves_geometry.cc
90

This calls the move operations internally, so it results in a stack overflow (P2830).

source/blender/blenkernel/intern/curves_geometry_test.cc
40

I'm 95% sure that you didn't run this test yet, because it's not crashing for you. The reason might be that that CurvesGeometryTest is missing an s in the end.

This revision now requires changes to proceed.Mar 11 2022, 1:06 PM
  • Revert previous change, rename tests

I think it's simpler to just swap individual elements right now.

This revision is now accepted and ready to land.Mar 11 2022, 6:07 PM