MAINT-4009: Patching the memory leak occurring from the info icons that appear when hovering over a chat history item.

meow-7.2.2
Stinson Linden 2014-05-02 23:04:06 +01:00
parent 8247f51684
commit 205503dd84
2 changed files with 18 additions and 36 deletions

View File

@ -107,6 +107,7 @@ class LLChatHistoryHeader: public LLPanel
public:
LLChatHistoryHeader()
: LLPanel(),
mInfoCtrl(NULL),
mPopupMenuHandleAvatar(),
mPopupMenuHandleObject(),
mAvatarID(),
@ -129,9 +130,6 @@ public:
~LLChatHistoryHeader()
{
// Detach the info button so that it doesn't get destroyed (EXT-8463).
hideInfoCtrl();
if (mAvatarNameCacheConnection.connected())
{
mAvatarNameCacheConnection.disconnect();
@ -292,6 +290,11 @@ public:
mUserNameTextBox = getChild<LLTextBox>("user_name");
mTimeBoxTextBox = getChild<LLTextBox>("time_box");
mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile<LLUICtrl>("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance());
llassert(mInfoCtrl != NULL);
mInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, mInfoCtrl));
mInfoCtrl->setVisible(FALSE);
return LLPanel::postBuild();
}
@ -589,39 +592,19 @@ protected:
void showInfoCtrl()
{
if (mAvatarID.isNull() || mFrom.empty() || CHAT_SOURCE_SYSTEM == mSourceType) return;
if (!sInfoCtrl)
const bool isVisible = !mAvatarID.isNull() && !mFrom.empty() && CHAT_SOURCE_SYSTEM != mSourceType;
if (isVisible)
{
// *TODO: Delete the button at exit.
sInfoCtrl = LLUICtrlFactory::createFromFile<LLUICtrl>("inspector_info_ctrl.xml", NULL, LLPanel::child_registry_t::instance());
if (sInfoCtrl)
{
sInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, sInfoCtrl));
}
const LLRect sticky_rect = mUserNameTextBox->getRect();
S32 icon_x = llmin(sticky_rect.mLeft + mUserNameTextBox->getTextBoundingRect().getWidth() + 7, sticky_rect.mRight - 3);
mInfoCtrl->setOrigin(icon_x, sticky_rect.getCenterY() - mInfoCtrl->getRect().getHeight() / 2 ) ;
}
if (!sInfoCtrl)
{
llassert(sInfoCtrl != NULL);
return;
}
LLTextBox* name = getChild<LLTextBox>("user_name");
LLRect sticky_rect = name->getRect();
S32 icon_x = llmin(sticky_rect.mLeft + name->getTextBoundingRect().getWidth() + 7, sticky_rect.mRight - 3);
sInfoCtrl->setOrigin(icon_x, sticky_rect.getCenterY() - sInfoCtrl->getRect().getHeight() / 2 ) ;
addChild(sInfoCtrl);
mInfoCtrl->setVisible(isVisible);
}
void hideInfoCtrl()
{
if (!sInfoCtrl) return;
if (sInfoCtrl->getParent() == this)
{
removeChild(sInfoCtrl);
}
mInfoCtrl->setVisible(FALSE);
}
private:
@ -692,7 +675,7 @@ protected:
LLHandle<LLView> mPopupMenuHandleAvatar;
LLHandle<LLView> mPopupMenuHandleObject;
static LLUICtrl* sInfoCtrl;
LLUICtrl* mInfoCtrl;
LLUUID mAvatarID;
LLSD mObjectData;
@ -709,8 +692,6 @@ private:
boost::signals2::connection mAvatarNameCacheConnection;
};
LLUICtrl* LLChatHistoryHeader::sInfoCtrl = NULL;
LLChatHistory::LLChatHistory(const LLChatHistory::Params& p)
: LLUICtrl(p),
mMessageHeaderFilename(p.message_header),

View File

@ -93,14 +93,15 @@ class LLChatHistory : public LLUICtrl
* @return pointer to LLView separator object.
*/
LLView* getSeparator();
void onClickMoreText();
private:
/**
* Builds a message header.
* @return pointer to LLView header object.
*/
LLView* getHeader(const LLChat& chat,const LLStyle::Params& style_params, const LLSD& args);
void onClickMoreText();
public:
~LLChatHistory();
LLSD getValue() const;