Browse Source

UIViewComponentPeer: Clear focused peer on destruction to avoid dangling pointer

v6.1.6
reuk 3 years ago
parent
commit
ad4368bbf1
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm

+ 5
- 2
modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm View File

@@ -680,8 +680,13 @@ UIViewComponentPeer::UIViewComponentPeer (Component& comp, int windowStyleFlags,
Desktop::getInstance().addFocusChangeListener (this);
}
static UIViewComponentPeer* currentlyFocusedPeer = nullptr;
UIViewComponentPeer::~UIViewComponentPeer()
{
if (currentlyFocusedPeer == this)
currentlyFocusedPeer = nullptr;
currentTouches.deleteAllTouchesForPeer (this);
Desktop::getInstance().removeFocusChangeListener (this);
@@ -1007,8 +1012,6 @@ void UIViewComponentPeer::onScroll (UIPanGestureRecognizer* gesture)
#endif
//==============================================================================
static UIViewComponentPeer* currentlyFocusedPeer = nullptr;
void UIViewComponentPeer::viewFocusGain()
{
if (currentlyFocusedPeer != this)


Loading…
Cancel
Save