From 7ef7bbef65d8622668bc8a007766f25a70386d27 Mon Sep 17 00:00:00 2001
From: Seth ProductEngine <slitovchuk@productengine.com>
Date: Thu, 12 Apr 2012 23:09:32 +0300
Subject: [PATCH] MAINT-891 FIXED Disabled focus return from modal dialog after
 viewer logoff. Fixed boost trackable objects usage.

---
 indra/newview/llchiclet.cpp         | 14 +++++++-------
 indra/newview/llchiclet.h           |  4 ++++
 indra/newview/llimview.h            |  5 ++---
 indra/newview/lltoastalertpanel.cpp |  4 ++--
 4 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index aabab0ccb99..a661808d1ff 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -1113,8 +1113,8 @@ LLChicletPanel::~LLChicletPanel()
 	}
 }
 
-void im_chiclet_callback(LLChicletPanel* panel, const LLSD& data){
-	
+void LLChicletPanel::onMessageCountChanged(const LLSD& data)
+{
 	LLUUID session_id = data["session_id"].asUUID();
 	S32 unread = data["participant_unread"].asInteger();
 
@@ -1139,7 +1139,7 @@ void im_chiclet_callback(LLChicletPanel* panel, const LLSD& data){
 	}
 }
 
-void object_chiclet_callback(const LLSD& data)
+void LLChicletPanel::objectChicletCallback(const LLSD& data)
 {
 	LLUUID notification_id = data["notification_id"];
 	bool new_message = data["new_message"];
@@ -1163,10 +1163,10 @@ void object_chiclet_callback(const LLSD& data)
 BOOL LLChicletPanel::postBuild()
 {
 	LLPanel::postBuild();
-	LLIMModel::instance().addNewMsgCallback(boost::bind(im_chiclet_callback, this, _1));
-	LLIMModel::instance().addNoUnreadMsgsCallback(boost::bind(im_chiclet_callback, this, _1));
-	LLScriptFloaterManager::getInstance()->addNewObjectCallback(boost::bind(object_chiclet_callback, _1));
-	LLScriptFloaterManager::getInstance()->addToggleObjectFloaterCallback(boost::bind(object_chiclet_callback, _1));
+	LLIMModel::instance().addNewMsgCallback(boost::bind(&LLChicletPanel::onMessageCountChanged, this, _1));
+	LLIMModel::instance().addNoUnreadMsgsCallback(boost::bind(&LLChicletPanel::onMessageCountChanged, this, _1));
+	LLScriptFloaterManager::getInstance()->addNewObjectCallback(boost::bind(&LLChicletPanel::objectChicletCallback, this, _1));
+	LLScriptFloaterManager::getInstance()->addToggleObjectFloaterCallback(boost::bind(&LLChicletPanel::objectChicletCallback, this, _1));
 	LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLChicletPanel::findChiclet<LLChiclet>, this, _1));
 	LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLChicletPanel::onCurrentVoiceChannelChanged, this, _1));
 
diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h
index 1f1069dcb49..19683492c23 100644
--- a/indra/newview/llchiclet.h
+++ b/indra/newview/llchiclet.h
@@ -1158,6 +1158,10 @@ class LLChicletPanel : public LLPanel
 	 */
 	void onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param);
 
+	void onMessageCountChanged(const LLSD& data);
+
+	void objectChicletCallback(const LLSD& data);
+
 	typedef std::vector<LLChiclet*> chiclet_list_t;
 
 	/**
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index f07a78e2f77..7c2cd03d970 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -153,7 +153,6 @@ class LLIMModel :  public LLSingleton<LLIMModel>
 	std::map<LLUUID, LLIMSession*> mId2SessionMap;
 
 	typedef boost::signals2::signal<void(const LLSD&)> session_signal_t;
-	typedef boost::function<void(const LLSD&)> session_callback_t;
 	session_signal_t mNewMsgSignal;
 	session_signal_t mNoUnreadMsgsSignal;
 	
@@ -174,8 +173,8 @@ class LLIMModel :  public LLSingleton<LLIMModel>
 	 */
 	void processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id);
 
-	boost::signals2::connection addNewMsgCallback( session_callback_t cb ) { return mNewMsgSignal.connect(cb); }
-	boost::signals2::connection addNoUnreadMsgsCallback( session_callback_t cb ) { return mNoUnreadMsgsSignal.connect(cb); }
+	boost::signals2::connection addNewMsgCallback(const session_signal_t::slot_type& cb ) { return mNewMsgSignal.connect(cb); }
+	boost::signals2::connection addNoUnreadMsgsCallback(const session_signal_t::slot_type& cb ) { return mNoUnreadMsgsSignal.connect(cb); }
 
 	/**
 	 * Create new session object in a model
diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp
index 9ba8431fdea..8fef2ed6d12 100644
--- a/indra/newview/lltoastalertpanel.cpp
+++ b/indra/newview/lltoastalertpanel.cpp
@@ -424,8 +424,8 @@ LLToastAlertPanel::~LLToastAlertPanel()
 			LLTransientFloaterMgr::GLOBAL, this);
 
 	// EXP-1822
-	// return focus to the previously focused view
-	if (mPreviouslyFocusedView.get())
+	// return focus to the previously focused view if the viewer is not exiting
+	if (mPreviouslyFocusedView.get() && !LLApp::isExiting())
 	{
 		mPreviouslyFocusedView.get()->setFocus(TRUE);
 	}
-- 
GitLab