There seems to be a bug in ScopedPointer::operator= from an rvalue.
To reproduce the bug one can change the JUCE Demo’s AudioLatencyDemo for example:
- In
AudioLatencyDemo::startTest(), remove theif (latencyTester == nullptr)check. It’s ok to create a newLatencyTestereach time it seems. - Change the expression
new LatencyTester (resultsBox)toScopedPointer<LatencyTester> (new LatencyTester (resultsBox)). - Run the JUCE demo (tested here on OS X 10.11.6 with Xcode 8.0 beta 4, on the current
developbranch - commit70530a9) in debug. - In the audio latency demo, run the latency more than once. Every time after the first leaks the previous tester object.
- Quit the JUCE demo. You should now get an assertion error for leaking
LatencyTesterobjects.
This seems to be the offending line: https://github.com/julianstorer/JUCE/commit/a92c7502b4e0246f8b28f214f8b2b52c73bf67c1#commitcomment-18830823
Cheers, Yair
