diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index aabab0ccb9982e8d9243f840eacdee24a39eb4f5..a661808d1ff4b0ad10c8f8310a81d390716ebbbd 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 1f1069dcb492a7d81dcfcf56b6fc875aca37229f..19683492c230e72968294a94ea56b989f2dd31b7 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 f07a78e2f77d33529c56ff389d04704c3f8b1a94..7c2cd03d9704f69c216c991c56620877ea868dae 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 9ba8431fdeac47a1f1fac5e4a024004584da07c5..8fef2ed6d1204151d0d46c25f3fcc85535312994 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);
 	}