CHUI-695: Viewer crash when accepting friend offer in conversations window. Problem was that LLIMToastNotifyPanel::snapToMessageHeight was calling LLToastPanel::reshape, which would then call LLIMToastNotifyPanel::reshape again. Resolution: Modified LLIMToastNotifyPanel::snapToMessageHeight to cleanly replicate what LLToastPanel::reshape was doing.
parent
b1d03f940d
commit
a33104ec55
|
|
@ -426,7 +426,27 @@ 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);
|
||||
snapToMessageHeight();
|
||||
}
|
||||
|
||||
void LLIMToastNotifyPanel::snapToMessageHeight()
|
||||
{
|
||||
if(!mTextBox)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Add message height if it is visible
|
||||
if (mTextBox->getVisible())
|
||||
{
|
||||
S32 new_panel_height = computeSnappedToMessageHeight(mTextBox, MAX_LENGTH);
|
||||
|
||||
//reshape the panel with new height
|
||||
if (new_panel_height != getRect().getHeight())
|
||||
{
|
||||
LLToastNotifyPanel::reshape( getRect().getWidth(), new_panel_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLIMToastNotifyPanel::compactButtons()
|
||||
|
|
|
|||
|
|
@ -157,6 +157,9 @@ public:
|
|||
protected:
|
||||
LLTextBase* mParentText;
|
||||
LLUUID mSessionID;
|
||||
|
||||
private:
|
||||
void snapToMessageHeight();
|
||||
};
|
||||
|
||||
#endif /* LLTOASTNOTIFYPANEL_H_ */
|
||||
|
|
|
|||
|
|
@ -58,6 +58,25 @@ const LLUUID& LLToastPanel::getID()
|
|||
return mNotification->id();
|
||||
}
|
||||
|
||||
S32 LLToastPanel::computeSnappedToMessageHeight(LLTextBase* message, S32 maxLineCount)
|
||||
{
|
||||
S32 heightDelta = 0;
|
||||
S32 maxTextHeight = message->getFont()->getLineHeight() * maxLineCount;
|
||||
|
||||
LLRect messageRect = message->getRect();
|
||||
S32 oldTextHeight = messageRect.getHeight();
|
||||
|
||||
//Knowing the height is set to max allowed, getTextPixelHeight returns needed text height
|
||||
//Perhaps we need to pass maxLineCount as parameter to getTextPixelHeight to avoid previous reshape.
|
||||
S32 requiredTextHeight = message->getTextBoundingRect().getHeight();
|
||||
S32 newTextHeight = llmin(requiredTextHeight, maxTextHeight);
|
||||
|
||||
heightDelta = newTextHeight - oldTextHeight;
|
||||
S32 new_panel_height = llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT);
|
||||
|
||||
return new_panel_height;
|
||||
}
|
||||
|
||||
//snap to the message height if it is visible
|
||||
void LLToastPanel::snapToMessageHeight(LLTextBase* message, S32 maxLineCount)
|
||||
{
|
||||
|
|
@ -69,19 +88,7 @@ void LLToastPanel::snapToMessageHeight(LLTextBase* message, S32 maxLineCount)
|
|||
//Add message height if it is visible
|
||||
if (message->getVisible())
|
||||
{
|
||||
S32 heightDelta = 0;
|
||||
S32 maxTextHeight = message->getFont()->getLineHeight() * maxLineCount;
|
||||
|
||||
LLRect messageRect = message->getRect();
|
||||
S32 oldTextHeight = messageRect.getHeight();
|
||||
|
||||
//Knowing the height is set to max allowed, getTextPixelHeight returns needed text height
|
||||
//Perhaps we need to pass maxLineCount as parameter to getTextPixelHeight to avoid previous reshape.
|
||||
S32 requiredTextHeight = message->getTextBoundingRect().getHeight();
|
||||
S32 newTextHeight = llmin(requiredTextHeight, maxTextHeight);
|
||||
|
||||
heightDelta = newTextHeight - oldTextHeight;
|
||||
S32 new_panel_height = llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT);
|
||||
S32 new_panel_height = computeSnappedToMessageHeight(message, maxLineCount);
|
||||
|
||||
//reshape the panel with new height
|
||||
if (new_panel_height != getRect().getHeight())
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public:
|
|||
protected:
|
||||
LLNotificationPtr mNotification;
|
||||
void snapToMessageHeight(LLTextBase* message, S32 maxLineCount);
|
||||
S32 computeSnappedToMessageHeight(LLTextBase* message, S32 maxLineCount);
|
||||
};
|
||||
|
||||
#endif /* LL_TOASTPANEL_H */
|
||||
|
|
|
|||
Loading…
Reference in New Issue