summaryrefslogtreecommitdiff
path: root/indra/llui/llfocusmgr.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-08-31 21:25:47 +0800
committerErik Kundiman <erik@megapahit.org>2024-09-01 20:43:42 +0800
commit95582654e49422d51b55665c3f2821c848ad1cb8 (patch)
treed6d03a887b8e1b6c3be1b139d63b1638c5d0fdcd /indra/llui/llfocusmgr.cpp
parentab3f483a3e5ed213882a83b882095cfdb6a4de57 (diff)
parentb0fefd62adbf51f32434ba077e9f52d8a9241d15 (diff)
Merge remote-tracking branch 'secondlife/release/2024.08-DeltaFPS' into 2024.08-DeltaFPS
Diffstat (limited to 'indra/llui/llfocusmgr.cpp')
-rw-r--r--indra/llui/llfocusmgr.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index e0e789f730..4f3d2328aa 100644
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -79,10 +79,20 @@ bool LLFocusableElement::wantsReturnKey() const
// virtual
LLFocusableElement::~LLFocusableElement()
{
- delete mFocusLostCallback;
- delete mFocusReceivedCallback;
- delete mFocusChangedCallback;
- delete mTopLostCallback;
+ auto free_signal = [&](focus_signal_t*& signal)
+ {
+ if (signal)
+ {
+ signal->disconnect_all_slots();
+ delete signal;
+ signal = nullptr;
+ }
+ };
+
+ free_signal(mFocusLostCallback);
+ free_signal(mFocusReceivedCallback);
+ free_signal(mFocusChangedCallback);
+ free_signal(mTopLostCallback);
}
void LLFocusableElement::onFocusReceived()
@@ -189,7 +199,7 @@ void LLFocusMgr::releaseFocusIfNeeded( LLView* view )
}
}
- LLUI::getInstance()->removePopup(view);
+ if(LLUI::instanceExists()) LLUI::getInstance()->removePopup(view);
}
void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, bool lock, bool keystrokes_only)
@@ -487,7 +497,7 @@ void LLFocusMgr::setAppHasFocus(bool focus)
// release focus from "top ctrl"s, which generally hides them
if (!focus)
{
- LLUI::getInstance()->clearPopups();
+ if(LLUI::instanceExists()) LLUI::getInstance()->clearPopups();
}
mAppHasFocus = focus;
}