What's a recommended solution for Logic AU not dismissing an alertwindow, I tried this code already ..?

I have a bug unique to Logic, AU component build.
I did see one or two others on the forum having a similar issue, e.g. here., @lalala

I did try this code, but it didn’t work. When I close the whole plugin window in Logic, my popup alertwindow which I invoked still stays visible, and if I click an option on that menu, Logic crashes.
Has there been an evolution in the JUCE framework to handle this, or some better way to deal with the issue?

Component* getParentComponentForMenuOptions (const PopupMenu::Options& options) override
{
    if (auto* comp = options.getParentComponent())
        return comp;

    if (auto* targetComp = options.getTargetComponent())
    {
        if (auto* editor = targetComp->findParentComponentOfClass<AudioProcessorEditor>())
            return editor;
    }

    return LookAndFeel_V4::getParentComponentForMenuOptions (options);
}

Anyone get anywhere with dismissAllActiveMenus()?

I did make a little progress with the popup menus.
Putting this in the Editor destructor dismissed my menu:
juce::PopupMenu::dismissAllActiveMenus();

I was hoping this would dismiss my dialog box alertwindow but it crashed Logic:
juce::ModalComponentManager::getInstance()->cancelAllModalComponents();