Salome HOME
Merge from branch CCRT_Port_V220.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttributePythonObject_i.cxx
index a02fa874eba13d2403b8cde375c32ec160dceb17..4c552be88733da35ed6b9e0a6bbc17d459f79aaf 100644 (file)
@@ -9,29 +9,38 @@
 //  Module : SALOME
 //  $Header$
 
-using namespace std;
 #include "SALOMEDS_AttributePythonObject_i.hxx"
+#include "SALOMEDS.hxx"
+
 #include <TCollection_ExtendedString.hxx>
 #include <TColStd_HArray1OfCharacter.hxx>
-#include "SALOMEDS_SObject_i.hxx"
+
+using namespace std;
 
 void SALOMEDS_AttributePythonObject_i::SetObject(const char* theSequence, CORBA::Boolean IsScript) {
+  SALOMEDS::Locker lock;
+
   CheckLocked();
-  char *aSeq = CORBA::string_dup(theSequence);
-  Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->SetObject(aSeq, IsScript);
+  Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->SetObject(const_cast<char*>(theSequence), IsScript);
 }
 
 char* SALOMEDS_AttributePythonObject_i::GetObject() {
+  SALOMEDS::Locker lock;
+
   char* aSeq = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->GetObject();
   CORBA::String_var aStr = CORBA::string_dup(aSeq);
   return aStr._retn();
 }
 
 CORBA::Boolean SALOMEDS_AttributePythonObject_i::IsScript() {
+  SALOMEDS::Locker lock;
+
   return Handle(SALOMEDS_PythonObjectAttribute)::DownCast(_myAttr)->IsScript();
 }
 
 char* SALOMEDS_AttributePythonObject_i::Store() {
+  SALOMEDS::Locker lock;
+
   CORBA::String_var aString = GetObject();
   char* aResult = new char[strlen(aString) + 2];
   aResult[0] = IsScript()?'s':'n';
@@ -39,7 +48,8 @@ char* SALOMEDS_AttributePythonObject_i::Store() {
   return aResult;
 }
 
-void SALOMEDS_AttributePythonObject_i::Restore(const char* value) {
-  char* aString = strdup(value);
-  SetObject(aString + 1, aString[0]=='s');
+void SALOMEDS_AttributePythonObject_i::Restore(const char* theValue) {
+  SALOMEDS::Locker lock;
+
+  SetObject(&theValue[1], theValue[0]=='s');
 }