]> OCCT Git - occt.git/commitdiff
0031944: Foundation Classes, Message_Report - add missing mutex locks for message...
authornds <nds@opencascade.com>
Sat, 31 Oct 2020 19:58:22 +0000 (22:58 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 17 Dec 2020 18:17:44 +0000 (21:17 +0300)
src/Message/Message_Report.cxx

index 2a0c458367231a913a6df67268a7ce7402c59972..d8ed266198c721090fdc82d5ca5bf3c79d7bc36a 100644 (file)
@@ -185,6 +185,8 @@ void Message_Report::UpdateActiveInMessenger (const Handle(Message_Messenger)& t
 //=======================================================================
 void Message_Report::AddLevel (Message_Level* theLevel, const TCollection_AsciiString& theName)
 {
+  Standard_Mutex::Sentry aSentry (myMutex);
+
   myAlertLevels.Append (theLevel);
 
   Handle(Message_AlertExtended) aLevelRootAlert = new Message_AlertExtended();
@@ -220,6 +222,8 @@ void Message_Report::AddLevel (Message_Level* theLevel, const TCollection_AsciiS
 
 void Message_Report::RemoveLevel (Message_Level* theLevel)
 {
+  Standard_Mutex::Sentry aSentry (myMutex);
+
   for (int aLevelIndex = myAlertLevels.Size(); aLevelIndex >= 1; aLevelIndex--)
   {
     Message_Level* aLevel = myAlertLevels.Value (aLevelIndex);
@@ -247,6 +251,8 @@ void Message_Report::Clear()
     return;
   }
 
+  Standard_Mutex::Sentry aSentry (myMutex);
+
   compositeAlerts()->Clear();
   myAlertLevels.Clear();
 }
@@ -262,6 +268,8 @@ void Message_Report::Clear (Message_Gravity theGravity)
     return;
   }
 
+  Standard_Mutex::Sentry aSentry (myMutex);
+
   compositeAlerts()->Clear (theGravity);
   myAlertLevels.Clear();
 }
@@ -277,6 +285,8 @@ void Message_Report::Clear (const Handle(Standard_Type)& theType)
     return;
   }
 
+  Standard_Mutex::Sentry aSentry (myMutex);
+
   compositeAlerts()->Clear (theType);
   myAlertLevels.Clear();
 }