DemoRunner windows video crash

Hi recently I tried running DemoRunner video demo on Windows 11.

After you start playing video and then clicking on for example “Code” tab demo crashes because component peer becomes unavailable…

This is my change to peerChanged() in DirectShowContext:

CriticalSection contextSection;

void peerChanged()
{
    deleteNativeWindow();

    mediaEvent->SetNotifyWindow (0, 0, 0);

    if (videoRenderer != nullptr)
        videoRenderer->setVideoWindow (nullptr);

    if (createNativeWindow() == true)
    {
        mediaEvent->CancelDefaultHandling (ComTypes::EC_STATE_CHANGE);
        mediaEvent->SetNotifyWindow ((ComTypes::OAHWND) hwnd, graphEventID, 0);

        if (videoRenderer != nullptr)
            videoRenderer->setVideoWindow (hwnd);
    }
    else
    {
        const ScopedLock lock (contextSection);
        component.close();
    }
}

Thanks, bye