Bug: weak_from_this called in constructor

Hi JUCE,

There’s a bug related to the lambda capture weak = weak_from_this() inside startScan(), which is called from the constructor of PluginListComponent::Scanner.

Calling weak_from_this() from within the constructor happens before the shared_ptr has been fully constructed, and so the resulting weak_ptr is always nullptr.

In the plug-in scanner in my application, this was showed as pressing the “Cancel” button doing nothing during Audio Unit scan. But, reproducing this specific behavior isn’t necessary to reason about that weak_from_this() is called used incorrectly.

I hope you can provide a fix asap.

Best,
Jelle

Thanks for reporting, that’s fixed here:

1 Like