From 46b55b6e4acb478bd5cd686b4d6046d7117621ec Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sun, 5 Feb 2023 19:45:52 -0500
Subject: [PATCH] Fix sound explorer persisting after close

---
 indra/newview/alfloaterexploresounds.cpp                  | 8 +++++---
 indra/newview/alfloaterexploresounds.h                    | 1 +
 .../skins/default/xui/en/floater_explore_sounds.xml       | 3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/indra/newview/alfloaterexploresounds.cpp b/indra/newview/alfloaterexploresounds.cpp
index 0a9ff9eb107..7aad2fbfa7e 100644
--- a/indra/newview/alfloaterexploresounds.cpp
+++ b/indra/newview/alfloaterexploresounds.cpp
@@ -74,7 +74,9 @@ BOOL ALFloaterExploreSounds::postBuild()
 	getChild<LLButton>("look_at_btn")->setClickedCallback(boost::bind(&ALFloaterExploreSounds::handleLookAt, this));
 	getChild<LLButton>("stop_btn")->setClickedCallback(boost::bind(&ALFloaterExploreSounds::handleStop, this));
 	getChild<LLButton>("bl_btn")->setClickedCallback(boost::bind(&ALFloaterExploreSounds::blacklistSound, this));
-	getChild<LLButton>("stop_locally_btn")->setClickedCallback(boost::bind(&ALFloaterExploreSounds::handleStopLocally, this));
+	
+	mStopLocalButton = getChild<LLButton>("stop_locally_btn");
+	mStopLocalButton->setClickedCallback(boost::bind(&ALFloaterExploreSounds::handleStopLocally, this));
 
 	mHistoryScroller = getChild<LLScrollListCtrl>("sound_list");
 	mHistoryScroller->setCommitCallback(boost::bind(&ALFloaterExploreSounds::handleSelection, this));
@@ -348,7 +350,7 @@ BOOL ALFloaterExploreSounds::tick()
 		}
 	}
 
-	childSetEnabled("stop_locally_btn", mLocalPlayingAudioSourceIDs.size() > 0);
+	mStopLocalButton->setEnabled(mLocalPlayingAudioSourceIDs.size() > 0);
 
 	return FALSE;
 }
@@ -377,7 +379,7 @@ void ALFloaterExploreSounds::handlePlayLocally()
 		}
 	}
 
-	childSetEnabled("stop_locally_btn", mLocalPlayingAudioSourceIDs.size() > 0);
+	mStopLocalButton->setEnabled(mLocalPlayingAudioSourceIDs.size() > 0);
 }
 
 void ALFloaterExploreSounds::handleLookAt()
diff --git a/indra/newview/alfloaterexploresounds.h b/indra/newview/alfloaterexploresounds.h
index 657e1547bc6..83093d81fb4 100644
--- a/indra/newview/alfloaterexploresounds.h
+++ b/indra/newview/alfloaterexploresounds.h
@@ -39,6 +39,7 @@ class ALFloaterExploreSounds final
 	LLCheckBoxCtrl*		mAvatarSounds;
 	LLCheckBoxCtrl*		mObjectSounds;
 	LLCheckBoxCtrl*		mPaused;
+	LLButton*			mStopLocalButton = nullptr;
 
 	std::list<LLSoundHistoryItem> mLastHistory;
 
diff --git a/indra/newview/skins/default/xui/en/floater_explore_sounds.xml b/indra/newview/skins/default/xui/en/floater_explore_sounds.xml
index 4216e508138..9b3655a4b3e 100644
--- a/indra/newview/skins/default/xui/en/floater_explore_sounds.xml
+++ b/indra/newview/skins/default/xui/en/floater_explore_sounds.xml
@@ -12,7 +12,8 @@
  title="Sounds"
  save_rect="true"
  save_visibility="true"
- single_instance="true">
+ single_instance="true"
+ reuse_instance="false">
 	<floater.string name="Playing">
 		Playing
 	</floater.string>
-- 
GitLab