From 5ad488a4a665f715c943004dce42f703204121cd Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 19 Apr 2024 22:40:49 +0300 Subject: viewer#1290 Fix snapToMessageHeight crash --- indra/newview/lltoastnotifypanel.cpp | 14 ++++++++++++-- indra/newview/lltoastnotifypanel.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 9db4bc4d3f..fe8312784d 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -56,8 +56,9 @@ const std::string LLToastNotifyPanel::sFontScript("SansSerif"); LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal; LLToastNotifyPanel::LLToastNotifyPanel(const LLNotificationPtr& notification, const LLRect& rect, bool show_images) -: LLCheckBoxToastPanel(notification), - LLInstanceTracker(notification->getID()) +: LLCheckBoxToastPanel(notification) +, LLInstanceTracker(notification->getID()) +, mTextBox(NULL) { init(rect, show_images); } @@ -432,6 +433,15 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) } } +void LLToastNotifyPanel::deleteAllChildren() +{ + // some visibility changes, re-init and reshape will attempt to + // use mTextBox. Null it beforehand to avoid crashes. + mTextBox = NULL; + + LLCheckBoxToastPanel::deleteAllChildren(); +} + bool LLToastNotifyPanel::isControlPanelEnabled() const { bool cp_enabled = mControlPanel->getEnabled(); diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index 4a6c2ada8a..8cfd0eb447 100644 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -63,6 +63,7 @@ public: LLToastNotifyPanel(const LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null, bool show_images = true); virtual void init( LLRect rect, bool show_images ); + virtual void deleteAllChildren(); virtual ~LLToastNotifyPanel(); LLPanel * getControlPanel() { return mControlPanel; } -- cgit v1.2.3