Direct2DFactories and DeletedAtShutdown

Hi Jules,

I’m following a bug reported that I cannot reproduce in house and using some trial/error, it seems related to DirectWrite usage.
I’ve taken a look at the code and I’m wondering if it’s ok that Direct2DFactories do not use the DeletedAtShutdown idiom ?

Thanks,

Can’t think of any obvious reasons why it’d be a problem for them to be normal statics… They should certainly outlive anything that uses them, so should all be ok.

Look like there is some leak in DirectWrite handling so my bug is maybe related to this.

I’ve put some logging in ComSmartPtr::release checking the return value of Release
when I’m in WindowsDirectWriteTypeface dtor, the dwFontFace returns 1 after its last release
when I’m in Direct2DFactories dtor, directWriteFactory return 2 after its last release

If it’s the juce leak detector that’s reporting a leak, it could just be a false alarm - if the runtime destroys the static object that detects the leaks before it destroys the static factory object, then it will think there’s a leak.

It’s not juce leak detector, just me checking the return value of Release of IUnknown when it should be 0 but it’s not.