EXT-8463 FIXED Crash in IM/chat floaters.

Reason
======

Each message in an IM/chat session has a header. The header shows an (i) button on hover and hides it when mouse leaves the header.

The button is shown by adding it as a header child and hidden by resetting the button parent.

So, if you close the IM session so that the hovered header doesn't get the MouseLeave message (e.g. by Ctrl+W),
the button gets destroyed. If you then open the IM session again and hover a message header, the destroyed button
is referenced, which leads to crash.

Fix
===

We make sure that when a hovered message header is being destroyed (by closing the IM session),
the button is detached (i.e. its parent gets reset), so that it remains usable.
I also add a couple of checks for the case when the (i) button fails to construct from XML file.

Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/783/

--HG--
branch : product-engine
meow-7.2.2
Vadim Savchuk 2010-07-20 19:59:34 +03:00
parent d3d39b98aa
commit 4d40d670a1
1 changed files with 17 additions and 1 deletions

View File

@ -111,6 +111,12 @@ public:
return pInstance;
}
~LLChatHistoryHeader()
{
// Detach the info button so that it doesn't get destroyed (EXT-8463).
hideInfoCtrl();
}
BOOL handleMouseUp(S32 x, S32 y, MASK mask)
{
return LLPanel::handleMouseUp(x,y,mask);
@ -382,8 +388,18 @@ protected:
if (!sInfoCtrl)
{
// *TODO: Delete the button at exit.
sInfoCtrl = LLUICtrlFactory::createFromFile<LLUICtrl>("inspector_info_ctrl.xml", NULL, LLPanel::child_registry_t::instance());
sInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, sInfoCtrl));
if (sInfoCtrl)
{
sInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, sInfoCtrl));
}
}
if (!sInfoCtrl)
{
llassert(sInfoCtrl != NULL);
return;
}
LLTextBase* name = getChild<LLTextBase>("user_name");