mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
DropShadower: Check for deletion after calling isWindowOnCurrentVirtualDesktop()
This commit is contained in:
parent
3e542f3465
commit
1059f7b022
2 changed files with 8 additions and 0 deletions
|
|
@ -157,9 +157,16 @@ private:
|
|||
|
||||
void timerCallback() override
|
||||
{
|
||||
WeakReference<DropShadower> deletionChecker { static_cast<DropShadower*> (listener) };
|
||||
|
||||
const auto wasOnVirtualDesktop = std::exchange (isOnVirtualDesktop,
|
||||
isWindowOnCurrentVirtualDesktop (root->getWindowHandle()));
|
||||
|
||||
// on Windows, isWindowOnCurrentVirtualDesktop() may cause synchronous messages to be dispatched
|
||||
// to the HWND so we need to check if the shadower is still valid after calling
|
||||
if (deletionChecker == nullptr)
|
||||
return;
|
||||
|
||||
if (isOnVirtualDesktop != wasOnVirtualDesktop)
|
||||
listener->componentVisibilityChanged (*root);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ private:
|
|||
std::unique_ptr<ParentVisibilityChangedListener> visibilityChangedListener;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DropShadower)
|
||||
JUCE_DECLARE_WEAK_REFERENCEABLE (DropShadower)
|
||||
};
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue