ComBaseClassHelper::QueryInterface breaks accessibility in release builds

This commit breaks accessibility in release builds. The problem is that compile-time and run-time __uuidof give different results:

debug: debug
release: release

A possible fix:

JUCE_COMRESULT QueryInterface (REFIID refId, void** result)
{
    constexpr IID ids[]{ __uuidof (ComClasses)... };
    void* bases[]{ static_cast<void*> (static_cast<ComClasses*> (this))... };

    for (size_t i = 0; i < sizeof... (ComClasses); ++i)
    {
        if (refId == ids[i])
        {
            this->AddRef();
            *result = bases[i];
            return S_OK;
        }
    }

    return ComBaseClassHelperBase<ComClasses...>::QueryInterface (refId, result);
}

Thanks for reporting. We’ve pushed a fix to develop here:

2 Likes