libanimation icon indicating copy to clipboard operation
libanimation copied to clipboard

Settings are not copied

Open zzag opened this issue 7 years ago • 0 comments

Currently, one can fall into the following trap:

wobbly::Model* model = nullptr;

...

if (...) {
    wobbly::Model::Settings settings;
    settings.springConstant = 8.0;
    settings.friction = 3.0;
    settings.maximumRange = 500.0;
    model = new wobbly::Model(Point(0.0, 0.0), 42.0, 42.0, settings);
}

...

model.Step(1);

When Model::Step() is called, Model::Private::mSettings will be a dangling reference.

zzag avatar Nov 23 '18 19:11 zzag