Closed gaborpapp closed 3 years ago
I guess when the vector resize gets called, the Channel copy constructor is getting called instead of the move, which is what I thought C++11 was all about. We can merge this PR to fix the problem, but it also seems like we need to figure out how to enable the move constructor for vector<ChannelT>
s..
Also only just realized that this PR fixes #2222 (I think it didn't get auto linked because of the 'cinder' prefix in your commit comment).
I checked this in Linux and macOS too. GCC and Clang both wrote broken exr's without this change. So it's probably not a compiler specific issue.
I guess worth noting that we should look into making Channel and Surface classes movable when held in std::vector
, but as I don't have the time to look into that at the moment will merge this as it is a clear bugfix for the current version.
Thanks for checking on other platforms, good find!
The vector storing the channel data should have a reserved size otherwise the pointers might get invalid if the vector is resized.