Unused COffscreenContect results in calling CDrawContect destructor twice!

I can’t be sure what version my VST_GUI is, but it’s about 4 years old.

I have an issue on one user’s macOS system where an COffscreenContext is created but not used and when the variable pointing to the COffscreenContect goes out of scope, the COffsceenContext destructor isn’t called, instead the CDrawContext destructor is called twice, leading to a crash. How do I resolve this issue?

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 CoreFoundation 0x192f9b5f4 CFRelease.cold.1 + 16
1 CoreFoundation 0x192dbad44 CFRelease + 132
2 eDRUMin 0x100181d4c VSTGUI::CGDrawContext::~CGDrawContext() + 68
3 eDRUMin 0x100181ddc VSTGUI::CGDrawContext::~CGDrawContext() + 20
4 eDRUMin 0x1001917e0 VSTGUI::NSViewFrame::createOffscreenContext(double, double, double) + 180

It looks like this issue stems from the user having a custom calibrated .icc monitor profile and the CDrawContext::fillLinearGradient() method failing to load colors properly. When the user removed his calibrated icc profile, the issue went away. Anyone else seen issues with calibrated displays?

I have a little more information. Apparently the issue only exists when using the new V4 ICC Max profiles. My customer switched to using an older V2 profile the issue goes away.