juce::ProgressBar - reason for constructor not using const?

ProgressBar polling on a ‘double’ reference. but does it modify it (I didn’t see such use / don’t expect it to).
Wouldn’t it be better to make the constructor get a const instead?

if it was const & you won’t have warning in lots of compiler if you were calling it
like ProgressBar(5.)

1 Like

Iiuc, this won’t crash. But instead would keep the timer callback until destructed.
Also might be useful for creating animated undefined progress indicator.

In my example it could lead to a crash because it reads undefined memory after the ctor is done.
You keep a reference on a temporary object which is destroyed after the fonction is called.