From 51935673458479fccf6e2857a3ab5aeffaf11d23 Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Tue, 26 Jul 2016 11:42:54 +0300
Subject: [PATCH] MAINT-6592 Duplicate entries are shown in Object list in
 Script info floater after clicking "Return" button

---
 indra/newview/llfloaterscriptlimits.cpp | 10 ++++++++++
 indra/newview/llfloaterscriptlimits.h   |  1 +
 2 files changed, 11 insertions(+)

diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp
index 7b8fc5b35bf..eae16b9f03d 100644
--- a/indra/newview/llfloaterscriptlimits.cpp
+++ b/indra/newview/llfloaterscriptlimits.cpp
@@ -660,6 +660,8 @@ BOOL LLPanelScriptLimitsRegionMemory::postBuild()
 	{
 		return FALSE;
 	}
+	list->setCommitCallback(boost::bind(&LLPanelScriptLimitsRegionMemory::checkButtonsEnabled, this));
+	checkButtonsEnabled();
 
 	//set all columns to resizable mode even if some columns will be empty
 	for(S32 column = 0; column < list->getNumColumns(); column++)
@@ -750,6 +752,14 @@ void LLPanelScriptLimitsRegionMemory::clearList()
 	getChild<LLUICtrl>("parcels_listed")->setValue(LLSD(msg_empty_string));
 
 	mObjectListItems.clear();
+	checkButtonsEnabled();
+}
+
+void LLPanelScriptLimitsRegionMemory::checkButtonsEnabled()
+{
+	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("scripts_list");
+	getChild<LLButton>("highlight_btn")->setEnabled(list->getNumSelected() > 0);
+	getChild<LLButton>("return_btn")->setEnabled(list->getNumSelected() > 0);
 }
 
 // static
diff --git a/indra/newview/llfloaterscriptlimits.h b/indra/newview/llfloaterscriptlimits.h
index e3cbbd185fc..2ac3862b4f3 100644
--- a/indra/newview/llfloaterscriptlimits.h
+++ b/indra/newview/llfloaterscriptlimits.h
@@ -113,6 +113,7 @@ class LLPanelScriptLimitsRegionMemory : public LLPanelScriptLimitsInfo, LLRemote
 	void showBeacon();
 	void returnObjectsFromParcel(S32 local_id);
 	void returnObjects();
+	void checkButtonsEnabled();
 
 private:
 	void onNameCache(const LLUUID& id,
-- 
GitLab