diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h
index ae836645b90b9f9097f2482b84ebd662ef2859ca..b3b56321d399bf57360bab190e7c717a43fccb1b 100755
--- a/indra/llcommon/llinitparam.h
+++ b/indra/llcommon/llinitparam.h
@@ -1952,7 +1952,7 @@ namespace LLInitParam
 		class Mandatory : public TypedParam<T, NAME_VALUE_LOOKUP, false>
 		{
 			typedef TypedParam<T, NAME_VALUE_LOOKUP, false>		super_t;
-			typedef Mandatory<T, NAME_VALUE_LOOKUP>										self_t;
+			typedef Mandatory<T, NAME_VALUE_LOOKUP>				self_t;
 			typedef typename super_t::value_t					value_t;
 			typedef typename super_t::default_value_t			default_value_t;
 
@@ -1980,6 +1980,7 @@ namespace LLInitParam
 			static bool validate(const Param* p)
 			{
 				// valid only if provided
+                llassert(p);
 				return static_cast<const self_t*>(p)->isProvided();
 			}
 
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index 361182380ae01164fefd4212e88298ab3dfe61f6..7ef7d101db70bc73f1d0419430dff14decd9a760 100755
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -212,6 +212,7 @@ class LLInstanceTracker : public LLInstanceTrackerBase
 	}
 	void remove_()
 	{
+        if (getMap_().find(mInstanceKey) != getMap_().end())
 		getMap_().erase(mInstanceKey);
 	}
 
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 1789f003b91ecd843aba930d724b22e4184e4f48..0a79f2f5888a25eac6a1b67992735a02d74f8012 100755
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -1125,7 +1125,7 @@ LLNotificationChannel::LLNotificationChannel(const Params& p)
 	mName(p.name.isProvided() ? p.name : LLUUID::generateNewID().asString())
 {
 	BOOST_FOREACH(const std::string& source, p.sources)
-{
+    {
 		connectToChannel(source);
 	}
 }
@@ -1209,6 +1209,10 @@ LLNotifications::LLNotifications()
 	LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Notification.Show", boost::bind(&LLNotifications::addFromCallback, this, _2));
 }
 
+void LLNotifications::clear()
+{
+   mDefaultChannels.clear();
+}
 
 // The expiration channel gets all notifications that are cancelled
 bool LLNotifications::expirationFilter(LLNotificationPtr pNotification)
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index cd3728305e0d4516dd1c37536d0410e6baae2e2a..3b620084eee59165f2e2a1bf872b76df1892c5a7 100755
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -874,6 +874,13 @@ class LLNotifications :
 
 	friend class LLSingleton<LLNotifications>;
 public:
+
+    // Needed to clear up RefCounted things prior to actual destruction
+    // as the singleton nature of the class makes them do "bad things"
+    // on at least Mac, if not all 3 platforms
+    //
+    void clear();
+
 	// load all notification descriptions from file
 	// calling more than once will overwrite existing templates
 	// but never delete a template
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 1874cba4a4d0a800541933092d582a7f968899e3..75595f502f9ff5d613277cd6be8c04ad2d2867c2 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1614,6 +1614,8 @@ bool LLAppViewer::cleanup()
 	//ditch LLVOAvatarSelf instance
 	gAgentAvatarp = NULL;
 
+    LLNotifications::instance().clear();
+
 	// workaround for DEV-35406 crash on shutdown
 	LLEventPumps::instance().reset();