From d53725ece11eb3403128dd77834742a1d084138f Mon Sep 17 00:00:00 2001
From: James Cook <james@lindenlab.com>
Date: Tue, 18 Aug 2009 00:43:56 +0000
Subject: [PATCH] EXT-549 Viewer crash when attempting to close detatched top
 menu.  LLTearOffMenu wasn't registering its closeTearOff method because
 postBuild() isn't called because it isn't built from XML.  Moving
 registration of closeTearOff to the constructor fixes it.  Discussed with
 Steve, but not reviewed formally.

---
 indra/llui/llmenugl.cpp | 11 ++++-------
 indra/llui/llmenugl.h   |  2 --
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index b51884f8c06..5be53e6afc9 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -3385,17 +3385,14 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) :
 
 	// highlight first item (tear off item will be disabled)
 	mMenu->highlightNextItem(NULL);
-}
 
-LLTearOffMenu::~LLTearOffMenu()
-{
+	// Can't do this in postBuild() because that is only called for floaters
+	// constructed from XML.
+	mCloseSignal.connect(boost::bind(&LLTearOffMenu::closeTearOff, this));
 }
 
-// virtual
-BOOL LLTearOffMenu::postBuild()
+LLTearOffMenu::~LLTearOffMenu()
 {
-	mCloseSignal.connect(boost::bind(&LLTearOffMenu::closeTearOff, this));
-	return TRUE;
 }
 
 void LLTearOffMenu::draw()
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 1058877d10b..d39a02da28f 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -788,8 +788,6 @@ class LLTearOffMenu : public LLFloater
 	static LLTearOffMenu* create(LLMenuGL* menup);
 	virtual ~LLTearOffMenu();
 
-	virtual BOOL postBuild();
-	
 	virtual void draw(void);
 	virtual void onFocusReceived();
 	virtual void onFocusLost();
-- 
GitLab