From: mkr Date: Tue, 5 Dec 2006 10:07:27 +0000 (+0000) Subject: Fix for PAL14049 : EDF PAL 335 SMESH : SIGSEV when we save the file after a transform... X-Git-Tag: V3_2_4pre1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9a2782f64654a3be6195495631f0075c01921eb0;p=modules%2Fkernel.git Fix for PAL14049 : EDF PAL 335 SMESH : SIGSEV when we save the file after a transformation. --- diff --git a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx index 83d7ecd01..9d7717f12 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject_i.cxx @@ -40,9 +40,10 @@ void SALOMEDS_AttributePythonObject_i::SetObject(const char* theSequence, CORBA: char* SALOMEDS_AttributePythonObject_i::GetObject() { SALOMEDS::Locker lock; - char* aSeq = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->GetObject().ToCString(); - CORBA::String_var aStr = CORBA::string_dup(aSeq); - return aStr._retn(); + TCollection_AsciiString aSeq(Handle(SALOMEDSImpl_AttributePythonObject):: + DownCast(_impl)->GetObject().ToCString()); + return aSeq.ToCString(); + } CORBA::Boolean SALOMEDS_AttributePythonObject_i::IsScript() diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx index db54d1e1a..7267b3dfa 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx @@ -54,7 +54,7 @@ SALOMEDSImpl_AttributePythonObject::SALOMEDSImpl_AttributePythonObject() void SALOMEDSImpl_AttributePythonObject::SetObject(const TCollection_AsciiString& theSequence, const bool theScript) { - CheckLocked(); + CheckLocked(); Backup(); mySequence = theSequence; myIsScript = theScript; @@ -103,14 +103,11 @@ void SALOMEDSImpl_AttributePythonObject::Paste(const Handle(TDF_Attribute)& into TCollection_AsciiString SALOMEDSImpl_AttributePythonObject::Save() { - char* aString = (char*)GetObject().ToCString(); - char* aResult = new char[strlen(aString) + 2]; - aResult[0] = IsScript()?'s':'n'; - strcpy(aResult+1, aString); - TCollection_AsciiString ret(aResult); + TCollection_AsciiString aString = GetObject(); + TCollection_AsciiString aResult = IsScript()?'s':'n'; + aResult += aString; - delete aResult; - return ret; + return aResult; } void SALOMEDSImpl_AttributePythonObject::Load(const TCollection_AsciiString& value)