JUCE icon indicating copy to clipboard operation
JUCE copied to clipboard

juce_core: Fix infinite allocation loop in AllocationHooks

Open aggniesz opened this issue 1 year ago • 0 comments
trafficstars

AllocationHooks has a ListenerList member variable which was recently updated to allocate on instantiation of its internal listeners list: const SharedListeners listeners = std::make_shared<ArrayType>();

Call to std::make_shared allocates which results in an infinite loop: operator new is called which attempts to access the static AllocationHooks object which does not yet exist - so the constructor gets called again, which then calls operator new again, and so round and round it goes - which unfortunately renders that feature unusable at the moment.

As nice as maintaining a unified approach to handling listeners would be, I don't think there's much need to support multiple listeners as AllocationHooks primary reason for existence is UnitTestAllocationChecker so I've simplified it to handle a single Listener only.

aggniesz avatar Feb 28 '24 14:02 aggniesz