diff options
author | Stinson Linden <stinson@lindenlab.com> | 2014-05-02 00:32:31 +0100 |
---|---|---|
committer | Stinson Linden <stinson@lindenlab.com> | 2014-05-02 00:32:31 +0100 |
commit | 8247f51684ecc73cc60fa64b2fb0de3dce2a0c26 (patch) | |
tree | 770989564df58a97db0c41a35f9c22b2d6235a30 /indra/llui/lltabcontainer.cpp | |
parent | 827a9f7c2d98a10d09ab87b16c92a22295f21cde (diff) |
MAINT-4009: Patching the memory leak occurring in the scenario where avatar icon was being created, but the tab container did not have a button to accept the gieven icon.
Diffstat (limited to 'indra/llui/lltabcontainer.cpp')
-rwxr-xr-x | indra/llui/lltabcontainer.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 273e9c1ef6..6f858cdeb3 100755 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1647,16 +1647,26 @@ void LLTabContainer::setTabImage(LLPanel* child, LLIconCtrl* icon) { LLTabTuple* tuple = getTabByPanel(child); LLCustomButtonIconCtrl* button; + bool hasButton = false; if(tuple) { button = dynamic_cast<LLCustomButtonIconCtrl*>(tuple->mButton); if(button) { + hasButton = true; button->setIcon(icon); reshapeTuple(tuple); } } + + if (!hasButton && (icon != NULL)) + { + // It was assumed that the tab's button would take ownership of the icon pointer. + // But since the tab did not have a button, kill the icon to prevent the memory + // leak. + icon->die(); + } } void LLTabContainer::reshapeTuple(LLTabTuple* tuple) |