diff options
| author | Vadim Savchuk <vsavchuk@productengine.com> | 2010-07-20 19:59:34 +0300 | 
|---|---|---|
| committer | Vadim Savchuk <vsavchuk@productengine.com> | 2010-07-20 19:59:34 +0300 | 
| commit | 4d40d670a119d753ff59076d80bd5d2bf2c02c80 (patch) | |
| tree | 091a4c257f15e9185d07aa01d664a8838b143738 | |
| parent | d3d39b98aa0b0161be4e573c440ce642617d6d15 (diff) | |
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
| -rw-r--r-- | indra/newview/llchathistory.cpp | 18 | 
1 files changed, 17 insertions, 1 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index c0fa910f86..7c33923f04 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -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");  | 
