corrections to IPAL 22059 SIGSEGV on closing study

This commit is contained in:
dmv 2010-10-11 13:51:55 +00:00
parent b9038c7474
commit 60503363ee
7 changed files with 31 additions and 33 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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<SalomeApp_Study*>( 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<QString, GEOM::GEOM_Object_var>
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

View File

@ -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:

View File

@ -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());

View File

@ -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;

View File

@ -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;