diff options
author | Stinson Linden <stinson@lindenlab.com> | 2014-05-02 23:04:06 +0100 |
---|---|---|
committer | Stinson Linden <stinson@lindenlab.com> | 2014-05-02 23:04:06 +0100 |
commit | 205503dd84479be4989e5f5567a1d187cc0e71eb (patch) | |
tree | b9692f32105d3697e9ade1d3ca01755aae8aa910 /indra | |
parent | 8247f51684ecc73cc60fa64b2fb0de3dce2a0c26 (diff) |
MAINT-4009: Patching the memory leak occurring from the info icons that appear when hovering over a chat history item.
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llchathistory.cpp | 47 | ||||
-rwxr-xr-x | indra/newview/llchathistory.h | 7 |
2 files changed, 18 insertions, 36 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 05c4181714..84b9ac756a 100755 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -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) - { - // *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)); - } - } - - if (!sInfoCtrl) + const bool isVisible = !mAvatarID.isNull() && !mFrom.empty() && CHAT_SOURCE_SYSTEM != mSourceType; + if (isVisible) { - llassert(sInfoCtrl != NULL); - return; + 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 ) ; } - - 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), diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h index bb6d4fb59c..44736a0489 100755 --- a/indra/newview/llchathistory.h +++ b/indra/newview/llchathistory.h @@ -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; |