Skip to content
Snippets Groups Projects
Commit 8247f516 authored by Stinson Linden's avatar Stinson Linden
Browse files

MAINT-4009: Patching the memory leak occurring in the scenario where avatar...

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.
parent 827a9f7c
No related branches found
No related tags found
No related merge requests found
...@@ -1647,16 +1647,26 @@ void LLTabContainer::setTabImage(LLPanel* child, LLIconCtrl* icon) ...@@ -1647,16 +1647,26 @@ void LLTabContainer::setTabImage(LLPanel* child, LLIconCtrl* icon)
{ {
LLTabTuple* tuple = getTabByPanel(child); LLTabTuple* tuple = getTabByPanel(child);
LLCustomButtonIconCtrl* button; LLCustomButtonIconCtrl* button;
bool hasButton = false;
if(tuple) if(tuple)
{ {
button = dynamic_cast<LLCustomButtonIconCtrl*>(tuple->mButton); button = dynamic_cast<LLCustomButtonIconCtrl*>(tuple->mButton);
if(button) if(button)
{ {
hasButton = true;
button->setIcon(icon); button->setIcon(icon);
reshapeTuple(tuple); 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) void LLTabContainer::reshapeTuple(LLTabTuple* tuple)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment