From 2964925fa295f455fca489edbcdbbc5365182308 Mon Sep 17 00:00:00 2001
From: AndreyL ProductEngine <alihatskiy@productengine.com>
Date: Wed, 25 Jul 2018 05:24:58 +0300
Subject: MAINT-8922 Crashfix

---
 indra/newview/llfloaterregioninfo.cpp | 33 ++++++++++++++++++++++-----------
 indra/newview/llfloaterregioninfo.h   | 10 ++++++----
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index da90108186..38fa3bd153 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -276,6 +276,18 @@ void LLFloaterRegionInfo::onOpen(const LLSD& key)
 	requestRegionInfo();
 	requestMeshRezInfo();
 
+	if (!mGodLevelChangeSlot.connected())
+	{
+		mGodLevelChangeSlot = gAgent.registerGodLevelChanageListener(boost::bind(&LLFloaterRegionInfo::onGodLevelChange, this, _1));
+	}
+}
+
+void LLFloaterRegionInfo::onClose(bool app_quitting)
+{
+	if (mGodLevelChangeSlot.connected())
+	{
+		mGodLevelChangeSlot.disconnect();
+	}
 }
 
 // static
@@ -588,6 +600,15 @@ void LLFloaterRegionInfo::disableTopButtons()
 	getChildView("top_scripts_btn")->setEnabled(false);
 }
 
+void LLFloaterRegionInfo::onGodLevelChange(U8 god_level)
+{
+	LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
+	if (floater && floater->getVisible())
+	{
+		refreshFromRegion(gAgent.getRegion());
+	}
+}
+
 ///----------------------------------------------------------------------------
 /// Local class implementation
 ///----------------------------------------------------------------------------
@@ -708,11 +729,6 @@ void LLPanelRegionInfo::disableButton(const std::string& btn_name)
 void LLPanelRegionInfo::initCtrl(const std::string& name)
 {
 	getChild<LLUICtrl>(name)->setCommitCallback(boost::bind(&LLPanelRegionInfo::onChangeAnything, this));
-
-	if (!mGodLevelChangeSlot.connected())
-	{
-		mGodLevelChangeSlot = gAgent.registerGodLevelChanageListener(boost::bind(&LLPanelRegionInfo::onGodLevelChange, this, _1));
-	}
 }
 
 void LLPanelRegionInfo::onClickManageTelehub()
@@ -721,11 +737,6 @@ void LLPanelRegionInfo::onClickManageTelehub()
 	LLFloaterReg::showInstance("telehubs");
 }
 
-void LLPanelRegionInfo::onGodLevelChange(U8 god_level)
-{
-	refreshFromRegion(gAgent.getRegion());
-}
-
 /////////////////////////////////////////////////////////////////////////////
 // LLPanelRegionGeneralInfo
 //
@@ -4117,6 +4128,6 @@ void LLPanelEstateAccess::searchAgent(LLNameListCtrl* listCtrl, const std::strin
 bool LLPanelEstateAccess::refreshFromRegion(LLViewerRegion* region)
 {
 	updateLists();
-	return true;
+	return LLPanelRegionInfo::refreshFromRegion(region);
 }
 
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index 2732b3e5f9..5b4c81000e 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -81,6 +81,7 @@ public:
 
 
 	/*virtual*/ void onOpen(const LLSD& key);
+	/*virtual*/ void onClose(bool app_quitting);
 	/*virtual*/ BOOL postBuild();
 
 	static void processEstateOwnerRequest(LLMessageSystem* msg, void**);
@@ -117,6 +118,7 @@ protected:
 	void onTabSelected(const LLSD& param);
 	void disableTabCtrls();
 	void refreshFromRegion(LLViewerRegion* region);
+	void onGodLevelChange(U8 god_level);
 
 	// member data
 	LLTabContainer* mTab;
@@ -124,6 +126,10 @@ protected:
 	info_panels_t mInfoPanels;
 	//static S32 sRequestSerial;	// serial # of last EstateOwnerRequest
 	static LLUUID sRequestInvoice;
+
+private:
+	LLAgent::god_level_change_slot_t   mGodLevelChangeSlot;
+
 };
 
 
@@ -164,13 +170,9 @@ protected:
 					 const LLUUID& invoice,
 					 const strings_t& strings);
 	
-	void onGodLevelChange(U8 god_level);
 	
 	// member data
 	LLHost mHost;
-
-private:
-	LLAgent::god_level_change_slot_t   mGodLevelChangeSlot;
 };
 
 /////////////////////////////////////////////////////////////////////////////
-- 
cgit v1.2.3