From daa9db305a5ae2c0c5b0c2425d6482de6dee7b2c Mon Sep 17 00:00:00 2001
From: AlexanderP ProductEngine <apaschenko@productengine.com>
Date: Wed, 23 Jan 2013 19:47:01 +0200
Subject: [PATCH] CHUI-695 Viewer crashes after attempt to accept a friendship
 in IM: remove an infinity loop of reshape()

---
 indra/newview/lltoastnotifypanel.cpp | 6 ++----
 indra/newview/lltoastpanel.cpp       | 4 +++-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index 268b68b539d..0aab5145319 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -537,11 +537,9 @@ LLIMToastNotifyPanel::~LLIMToastNotifyPanel()
 }
 
 void LLIMToastNotifyPanel::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */)
-	{
-	LLToastPanel::reshape(width, height, called_from_parent);
-
+{
 	snapToMessageHeight(mTextBox, MAX_LENGTH);
-	}
+}
 
 void LLIMToastNotifyPanel::compactButtons()
 {
diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp
index 187aee207c4..54d3912136b 100644
--- a/indra/newview/lltoastpanel.cpp
+++ b/indra/newview/lltoastpanel.cpp
@@ -81,7 +81,9 @@ void LLToastPanel::snapToMessageHeight(LLTextBase* message, S32 maxLineCount)
 		S32 newTextHeight = llmin(requiredTextHeight, maxTextHeight);
 
 		heightDelta = newTextHeight - oldTextHeight;
-		S32 new_panel_height = llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT);
+		S32 new_panel_height = llmin(
+				llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT),
+				maxTextHeight);
 
 		//reshape the panel with new height
 		if (new_panel_height != getRect().getHeight())
-- 
GitLab