From: dmv Date: Mon, 11 Oct 2010 13:51:55 +0000 (+0000) Subject: corrections to IPAL 22059 SIGSEGV on closing study X-Git-Tag: V5_1_5rc1~34 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=60503363ee7030af9e109c8de13b867721a55fcd;p=modules%2Fgeom.git corrections to IPAL 22059 SIGSEGV on closing study --- diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index 6cbf4f374..efd69ff3c 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -893,7 +893,7 @@ GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromIOR( const char* theIOR ) // function : GetIORFromObject() // purpose : returns IOR of a given GEOM_Object //======================================================================= -char* GEOMBase::GetIORFromObject( const GEOM::GEOM_Object_ptr& theObject ) +QString GEOMBase::GetIORFromObject( const GEOM::GEOM_Object_ptr& theObject ) { if ( CORBA::is_nil( theObject ) ) return NULL; diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index e1bd56882..fb846fe3c 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -90,7 +90,7 @@ public : static GEOM::GEOM_Object_ptr GetObjectFromIOR(const char* theIOR); - static char* GetIORFromObject(const GEOM::GEOM_Object_ptr& theObject); + static QString GetIORFromObject(const GEOM::GEOM_Object_ptr& theObject); /* Geometry */ static bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P); diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx index 02bc2980f..de5f92978 100755 --- a/src/GEOMBase/GEOMBase_Helper.cxx +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -170,9 +170,10 @@ void GEOMBase_Helper::erase( const ObjectList& objList, const bool updateView ) void GEOMBase_Helper::erase( GEOM::GEOM_Object_ptr object, const bool updateView ) { if ( !object->_is_nil() ) { - std::string entry = getEntry( object ); + QString entry = getEntry( object ); getDisplayer()->Erase( new SALOME_InteractiveObject( - entry.c_str(), "GEOM", strdup( GEOMBase::GetName( object ).toLatin1().constData() ) ), true, updateView ); + entry.toLatin1().constData(), + "GEOM", strdup( GEOMBase::GetName( object ).toLatin1().constData() ) ), true, updateView ); } } @@ -209,9 +210,9 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, // Enable activisation of selection getDisplayer()->SetToActivate( true ); - std::string entry = getEntry( object ); + QString entry = getEntry( object ); getDisplayer()->Redisplay(new SALOME_InteractiveObject - (entry.c_str(), "GEOM", strdup(GEOMBase::GetName(object).toLatin1().constData())), false); + (entry.toLatin1().constData(), "GEOM", strdup(GEOMBase::GetName(object).toLatin1().constData())), false); } if ( withChildren ) { @@ -227,9 +228,9 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, (GeometryGUI::ClientSObjectToObject(anIt->Value())); if ( !CORBA::is_nil( aChild ) ) { if ( !aChild->_is_nil() ) { - std::string entry = getEntry( aChild ); + QString entry = getEntry( aChild ); getDisplayer()->Redisplay( new SALOME_InteractiveObject( - entry.c_str(), "GEOM", strdup( GEOMBase::GetName( aChild ).toLatin1().constData() ) ), false ); + entry.toLatin1().constData(), "GEOM", strdup( GEOMBase::GetName( aChild ).toLatin1().constData() ) ), false ); } } } @@ -449,10 +450,10 @@ void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const int theMo GEOM::GEOM_Object_ptr anObj = *anIter; if ( anObj->_is_nil() ) continue; - std::string aEntry = getEntry( anObj ); - if ( aEntry != "" ) + QString anEntry = getEntry( anObj ); + if ( anEntry != "" ) aListOfIO.Append( new SALOME_InteractiveObject( - aEntry.c_str(), "GEOM", strdup( GEOMBase::GetName( anObj ).toLatin1().constData() ) ) ); + anEntry.toLatin1().constData(), "GEOM", strdup( GEOMBase::GetName( anObj ).toLatin1().constData() ) ) ); } getDisplayer()->LocalSelection( aListOfIO, theMode ); @@ -619,19 +620,18 @@ SalomeApp_Study* GEOMBase_Helper::getStudy() const // Function : getEntry // Purpose : //================================================================ -char* GEOMBase_Helper::getEntry( GEOM::GEOM_Object_ptr object ) const +QString GEOMBase_Helper::getEntry( GEOM::GEOM_Object_ptr object ) const { SalomeApp_Study* study = getStudy(); if ( study ) { - CORBA::String_var objIOR = GEOMBase::GetIORFromObject( object ); - std::string IOR( objIOR ); - if ( IOR != "" ) { - _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); + QString objIOR = GEOMBase::GetIORFromObject( object ); + if ( objIOR != "" ) { + _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( objIOR.toLatin1().constData() ) ); if ( SO ) - return (char*) TCollection_AsciiString((char*)SO->GetID().c_str()).ToCString(); + return QString::fromStdString(SO->GetID()); } } - return (char*)""; + return ""; } //================================================================ @@ -1023,9 +1023,8 @@ bool GEOMBase_Helper::selectObjects( ObjectList& objects ) ObjectList::iterator anIter; for ( anIter = objects.begin(); anIter != objects.end(); ++anIter ) { - std::string entry = getEntry( *anIter ); - QString aEntry( entry.c_str() ); - LightApp_DataOwner* anOwher = new LightApp_DataOwner( aEntry ); + QString anEntry = getEntry( *anIter ); + LightApp_DataOwner* anOwher = new LightApp_DataOwner( anEntry ); aList.append( anOwher ); } @@ -1055,8 +1054,8 @@ GEOM::GEOM_Object_ptr GEOMBase_Helper::findObjectInFather (GEOM::GEOM_Object_ptr dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); _PTR(Study) aDStudy = appStudy->studyDS(); - std::string IOR = GEOMBase::GetIORFromObject( theFather ); - _PTR(SObject) SObj ( aDStudy->FindObjectIOR( IOR ) ); + QString IOR = GEOMBase::GetIORFromObject( theFather ); + _PTR(SObject) SObj ( aDStudy->FindObjectIOR( IOR.toLatin1().constData() ) ); bool inStudy = false; GEOM::GEOM_Object_var aReturnObject; @@ -1102,7 +1101,7 @@ void GEOMBase_Helper::addSubshapesToFather( QMap if ( !anOp->_is_nil() ) { GEOM::GEOM_Object_var aFatherObj = anOp->GetMainShape( it.value() ); if ( !aFatherObj->_is_nil() ) { - std::string aFatherEntry = getEntry( aFatherObj ); + QString aFatherEntry = getEntry( aFatherObj ); if ( aFatherEntry != "") { // additional checking that object is valid 0020598 EDF 1191 GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aFatherObj, it.key().toLatin1().data() ); //Add Object to study if its not exist diff --git a/src/GEOMBase/GEOMBase_Helper.h b/src/GEOMBase/GEOMBase_Helper.h index b8e12adba..0a3fc2914 100755 --- a/src/GEOMBase/GEOMBase_Helper.h +++ b/src/GEOMBase/GEOMBase_Helper.h @@ -177,7 +177,7 @@ protected: SUIT_Desktop* getDesktop() const; private: - char* getEntry ( GEOM::GEOM_Object_ptr ) const; + QString getEntry( GEOM::GEOM_Object_ptr ) const; void clearShapeBuffer( GEOM::GEOM_Object_ptr ); private: diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx index 9771d89f6..01afe7a4d 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.cxx +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -1059,10 +1059,9 @@ bool GroupGUI_GroupDlg::execute(ObjectList& objects) SalomeApp_Study* study = getStudy(); if (study) { - CORBA::String_var objIOR = GEOMBase::GetIORFromObject(aGroup); - std::string IOR(objIOR); - if (IOR != "") { - _PTR(SObject) SO (study->studyDS()->FindObjectIOR(IOR)); + QString objIOR = GEOMBase::GetIORFromObject(aGroup); + if (objIOR != "") { + _PTR(SObject) SO (study->studyDS()->FindObjectIOR(objIOR.toLatin1().constData())); if (SO) { _PTR(StudyBuilder) aBuilder (study->studyDS()->NewBuilder()); aBuilder->SetName(SO, getNewObjectName().toLatin1().constData()); diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx index 5344991b4..20d7d7674 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx @@ -177,8 +177,8 @@ bool MeasureGUI_BndBoxDlg::getParameters( double& theXmin, double& theXmax, if ( CORBA::is_nil(aGeomGen) ) return false; - CORBA::String_var IOR = GEOMBase::GetIORFromObject( myObj ); - GEOM::GEOM_Object_var anObject = aGeomGen->GetIORFromString(IOR); + QString IOR = GEOMBase::GetIORFromObject( myObj ); + GEOM::GEOM_Object_var anObject = aGeomGen->GetIORFromString( IOR.toLatin1().constData() ); if ( CORBA::is_nil(anObject) ) return false; diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx index 717dfa4a6..2469cefe6 100644 --- a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx @@ -246,8 +246,8 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() aSelMgr->clearSelected(); Standard_Boolean isOk; - CORBA::String_var objIOR = GEOMBase::GetIORFromObject(myObject); - Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIORinGEOMAISShape(objIOR, isOk, true); + QString objIOR = GEOMBase::GetIORFromObject(myObject); + Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIORinGEOMAISShape(objIOR.toLatin1().constData(), isOk, true); if (!isOk || aSh.IsNull()) return;