Index: ThirdParty/CodePatterns/src/Observer/Notification.cpp
===================================================================
--- ThirdParty/CodePatterns/src/Observer/Notification.cpp	(revision ca2880ed15eab9a910df944f46133e3a8ee0bab1)
+++ ThirdParty/CodePatterns/src/Observer/Notification.cpp	(revision 9ac3d34592dc2b5d70b16ec889a33540b33203f5)
@@ -52,9 +52,12 @@
 void Notification::notifyAll(Observable * const publisher)
 {
-  boost::recursive_mutex::scoped_lock guard(TargetsLock);
-  // copy such that signOff() within receiving update() does not affect iterating
-  // this is because within the same thread and with the update() signOff() may be
-  // called and when executed it modifies targets
-  targets_t temp_targets = targets;
+  targets_t temp_targets;
+  {
+    boost::recursive_mutex::scoped_lock guard(TargetsLock);
+    // copy such that signOff() within receiving update() does not affect iterating
+    // this is because within the same thread and with the update() signOff() may be
+    // called and when executed it modifies targets
+    temp_targets = targets;
+  }
   for(targets_t::iterator it=temp_targets.begin();
       it!=temp_targets.end();++it){
Index: ThirdParty/CodePatterns/src/Observer/Observable.cpp
===================================================================
--- ThirdParty/CodePatterns/src/Observer/Observable.cpp	(revision ca2880ed15eab9a910df944f46133e3a8ee0bab1)
+++ ThirdParty/CodePatterns/src/Observer/Observable.cpp	(revision 9ac3d34592dc2b5d70b16ec889a33540b33203f5)
@@ -152,8 +152,17 @@
   // and call all observers
   try {
-    boost::recursive_mutex::scoped_lock lock(GlobalObservableInfo::getInstance().getObservablesMapMutex());
-    GlobalObservableInfo::calltable_t& callTable = GlobalObservableInfo::getInstance().getcallTable();
-    const bool callTable_contains = callTable.find(this) != callTable.end();
+    bool callTable_contains;
+    {
+      boost::recursive_mutex::scoped_lock lock(GlobalObservableInfo::getInstance().getObservablesMapMutex());
+      GlobalObservableInfo::calltable_t& callTable = GlobalObservableInfo::getInstance().getcallTable();
+      callTable_contains = callTable.find(this) != callTable.end();
+    }
     if (callTable_contains) {
+      GlobalObservableInfo::callees_t callees;
+      {
+        boost::recursive_mutex::scoped_lock lock(GlobalObservableInfo::getInstance().getObservablesMapMutex());
+        GlobalObservableInfo::calltable_t& callTable = GlobalObservableInfo::getInstance().getcallTable();
+        callees = callTable[this];
+      }
       // elements are stored sorted by keys in the multimap
       // so iterating over it gives us a the callees sorted by
@@ -162,5 +171,4 @@
       // this is because within the same thread and with the updateKilled() signOff() may be
       // called and when executed it modifies targets
-      GlobalObservableInfo::callees_t callees = callTable[this];
       GlobalObservableInfo::callees_t::iterator iter;
       for(iter=callees.begin();iter!=callees.end();++iter){
@@ -178,7 +186,9 @@
   // send out all notifications that need to be done
   {
-    boost::recursive_mutex::scoped_lock lock(GlobalObservableInfo::getInstance().getObservablesMapMutex());
-    GlobalObservableInfo::notificationSet currentNotifications =
-        (GlobalObservableInfo::getInstance().getnotifications())[this];
+    GlobalObservableInfo::notificationSet currentNotifications;
+    {
+      boost::recursive_mutex::scoped_lock lock(GlobalObservableInfo::getInstance().getObservablesMapMutex());
+      currentNotifications = (GlobalObservableInfo::getInstance().getnotifications())[this];
+    }
     for(GlobalObservableInfo::notificationSet::iterator it = currentNotifications.begin();
         it != currentNotifications.end();++it){
@@ -224,10 +234,13 @@
   }
   else {
-    boost::recursive_mutex::scoped_lock lock(GlobalObservableInfo::getInstance().getObservablesMapMutex());
-    // see if we are in the process of changing ourselves
-    // if we are changing ourselves at the same time our sub-observables change
-    // we do not need to publish all the changes at each time we are called
-    std::map<Observable*, int>& depth = GlobalObservableInfo::getInstance().getdepth();
-    const bool depth_contains = depth.find(this)==depth.end();
+    bool depth_contains;
+    {
+      boost::recursive_mutex::scoped_lock lock(GlobalObservableInfo::getInstance().getObservablesMapMutex());
+      // see if we are in the process of changing ourselves
+      // if we are changing ourselves at the same time our sub-observables change
+      // we do not need to publish all the changes at each time we are called
+      std::map<Observable*, int>& depth = GlobalObservableInfo::getInstance().getdepth();
+      depth_contains = depth.find(this)==depth.end();
+    }
     if(depth_contains) {
 #ifdef LOG_OBSERVER
@@ -409,10 +422,13 @@
   }
   if(CallTable_contains) {
-    // copy the list from the map
-    boost::recursive_mutex::scoped_lock lock(GlobalObservableInfo::getInstance().getObservablesMapMutex());
-    // copy such that signOff() within receiving subjectKilled() does not affect iterating
-    // this is because within the same thread and with the subjectKilled() signOff() may be
-    // called and when executed it modifies targets
-    GlobalObservableInfo::callees_t callees = (GlobalObservableInfo::getInstance().getcallTable())[this];
+    GlobalObservableInfo::callees_t callees;
+    {
+      // copy the list from the map
+      boost::recursive_mutex::scoped_lock lock(GlobalObservableInfo::getInstance().getObservablesMapMutex());
+      // copy such that signOff() within receiving subjectKilled() does not affect iterating
+      // this is because within the same thread and with the subjectKilled() signOff() may be
+      // called and when executed it modifies targets
+      callees = (GlobalObservableInfo::getInstance().getcallTable())[this];
+    }
     // delete all entries for this observable
     GlobalObservableInfo::callees_t::iterator iter;
@@ -420,5 +436,8 @@
       (*iter).second->subjectKilled(this);
     // erase the list in the map
-    (GlobalObservableInfo::getInstance().getcallTable()).erase(this);
+    {
+      boost::recursive_mutex::scoped_lock lock(GlobalObservableInfo::getInstance().getObservablesMapMutex());
+      (GlobalObservableInfo::getInstance().getcallTable()).erase(this);
+    }
   }
 
