mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
0023164: Problem with Dump Study in case of an import
- Fix problem caused by unhandled memory leaks
This commit is contained in:
parent
c749922c02
commit
1b44f73640
@ -36,10 +36,13 @@
|
||||
#include "GEOM_Operation.h"
|
||||
#include "GEOMBase.h"
|
||||
#include "GEOM_Displayer.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(BREPPlugin)
|
||||
|
||||
typedef GEOM::GenericObjPtr<GEOM::IBREPOperations> BREPOpPtr;
|
||||
|
||||
//=======================================================================
|
||||
// function : BREPPlugin_GUI()
|
||||
// purpose : Constructor
|
||||
@ -111,8 +114,8 @@ bool BREPPlugin_GUI::importBREP( SUIT_Desktop* parent )
|
||||
|
||||
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
|
||||
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "BREPPluginEngine" );
|
||||
GEOM::IBREPOperations_var brepOp = GEOM::IBREPOperations::_narrow( op );
|
||||
if ( CORBA::is_nil( brepOp ) ) return false;
|
||||
BREPOpPtr brepOp = GEOM::IBREPOperations::_narrow( op );
|
||||
if ( brepOp.isNull() ) return false;
|
||||
|
||||
QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
|
||||
tr( "BREP_FILES" ),
|
||||
@ -126,7 +129,7 @@ bool BREPPlugin_GUI::importBREP( SUIT_Desktop* parent )
|
||||
foreach( QString fileName, fileNames )
|
||||
{
|
||||
SUIT_OverrideCursor wc;
|
||||
GEOM_Operation transaction( app, brepOp.in() );
|
||||
GEOM_Operation transaction( app, brepOp.get() );
|
||||
|
||||
try
|
||||
{
|
||||
@ -145,6 +148,7 @@ bool BREPPlugin_GUI::importBREP( SUIT_Desktop* parent )
|
||||
entryList.append( so->GetID() );
|
||||
transaction.commit();
|
||||
GEOM_Displayer( study ).Display( main.in() );
|
||||
main->UnRegister();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -183,8 +187,8 @@ bool BREPPlugin_GUI::exportBREP( SUIT_Desktop* parent )
|
||||
|
||||
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
|
||||
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "BREPPluginEngine" );
|
||||
GEOM::IBREPOperations_var brepOp = GEOM::IBREPOperations::_narrow( op );
|
||||
if ( CORBA::is_nil( brepOp ) ) return false;
|
||||
BREPOpPtr brepOp = GEOM::IBREPOperations::_narrow( op );
|
||||
if ( brepOp.isNull() ) return false;
|
||||
|
||||
LightApp_SelectionMgr* sm = app->selectionMgr();
|
||||
if ( !sm ) return false;
|
||||
@ -212,7 +216,7 @@ bool BREPPlugin_GUI::exportBREP( SUIT_Desktop* parent )
|
||||
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
GEOM_Operation transaction( app, brepOp.in() );
|
||||
GEOM_Operation transaction( app, brepOp.get() );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -37,10 +37,13 @@
|
||||
#include "GEOM_Operation.h"
|
||||
#include "GEOMBase.h"
|
||||
#include "GEOM_Displayer.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(IGESPlugin)
|
||||
|
||||
typedef GEOM::GenericObjPtr<GEOM::IIGESOperations> IGESOpPtr;
|
||||
|
||||
//=======================================================================
|
||||
// function : IGESPlugin_GUI()
|
||||
// purpose : Constructor
|
||||
@ -109,8 +112,8 @@ bool IGESPlugin_GUI::importIGES( SUIT_Desktop* parent )
|
||||
|
||||
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
|
||||
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "IGESPluginEngine" );
|
||||
GEOM::IIGESOperations_var igesOp = GEOM::IIGESOperations::_narrow( op );
|
||||
if ( CORBA::is_nil( igesOp ) ) return false;
|
||||
IGESOpPtr igesOp = GEOM::IIGESOperations::_narrow( op );
|
||||
if ( igesOp.isNull() ) return false;
|
||||
|
||||
QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
|
||||
tr( "IGES_FILES" ),
|
||||
@ -126,7 +129,7 @@ bool IGESPlugin_GUI::importIGES( SUIT_Desktop* parent )
|
||||
{
|
||||
QString fileName = fileNames.at( i );
|
||||
SUIT_OverrideCursor wc;
|
||||
GEOM_Operation transaction( app, igesOp.in() );
|
||||
GEOM_Operation transaction( app, igesOp.get() );
|
||||
bool ignoreUnits = false;
|
||||
|
||||
try
|
||||
@ -182,6 +185,7 @@ bool IGESPlugin_GUI::importIGES( SUIT_Desktop* parent )
|
||||
entryList.append( so->GetID() );
|
||||
transaction.commit();
|
||||
GEOM_Displayer( study ).Display( main.in() );
|
||||
main->UnRegister();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -221,8 +225,8 @@ bool IGESPlugin_GUI::exportIGES( SUIT_Desktop* parent )
|
||||
|
||||
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
|
||||
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "IGESPluginEngine" );
|
||||
GEOM::IIGESOperations_var igesOp = GEOM::IIGESOperations::_narrow( op );
|
||||
if ( CORBA::is_nil( igesOp ) ) return false;
|
||||
IGESOpPtr igesOp = GEOM::IIGESOperations::_narrow( op );
|
||||
if ( igesOp.isNull() ) return false;
|
||||
|
||||
LightApp_SelectionMgr* sm = app->selectionMgr();
|
||||
if ( !sm ) return false;
|
||||
@ -251,7 +255,7 @@ bool IGESPlugin_GUI::exportIGES( SUIT_Desktop* parent )
|
||||
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
GEOM_Operation transaction( app, igesOp.in() );
|
||||
GEOM_Operation transaction( app, igesOp.get() );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -36,10 +36,13 @@
|
||||
#include "GEOM_Operation.h"
|
||||
#include "GEOMBase.h"
|
||||
#include "GEOM_Displayer.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(STEPPlugin)
|
||||
|
||||
typedef GEOM::GenericObjPtr<GEOM::ISTEPOperations> STEPOpPtr;
|
||||
|
||||
//=======================================================================
|
||||
// function : STEPPlugin_GUI()
|
||||
// purpose : Constructor
|
||||
@ -111,8 +114,8 @@ bool STEPPlugin_GUI::importSTEP( SUIT_Desktop* parent )
|
||||
|
||||
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
|
||||
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STEPPluginEngine" );
|
||||
GEOM::ISTEPOperations_var stepOp = GEOM::ISTEPOperations::_narrow( op );
|
||||
if ( CORBA::is_nil( stepOp ) ) return false;
|
||||
STEPOpPtr stepOp = GEOM::ISTEPOperations::_narrow( op );
|
||||
if ( stepOp.isNull() ) return false;
|
||||
|
||||
QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
|
||||
tr( "STEP_FILES" ),
|
||||
@ -128,7 +131,7 @@ bool STEPPlugin_GUI::importSTEP( SUIT_Desktop* parent )
|
||||
{
|
||||
QString fileName = fileNames.at( i );
|
||||
SUIT_OverrideCursor wc;
|
||||
GEOM_Operation transaction( app, stepOp.in() );
|
||||
GEOM_Operation transaction( app, stepOp.get() );
|
||||
bool ignoreUnits = false;
|
||||
|
||||
try
|
||||
@ -189,6 +192,7 @@ bool STEPPlugin_GUI::importSTEP( SUIT_Desktop* parent )
|
||||
}
|
||||
transaction.commit();
|
||||
GEOM_Displayer( study ).Display( main.in() );
|
||||
main->UnRegister();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -228,8 +232,8 @@ bool STEPPlugin_GUI::exportSTEP( SUIT_Desktop* parent )
|
||||
|
||||
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
|
||||
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STEPPluginEngine" );
|
||||
GEOM::ISTEPOperations_var stepOp = GEOM::ISTEPOperations::_narrow( op );
|
||||
if ( CORBA::is_nil( stepOp ) ) return false;
|
||||
STEPOpPtr stepOp = GEOM::ISTEPOperations::_narrow( op );
|
||||
if ( stepOp.isNull() ) return false;
|
||||
|
||||
LightApp_SelectionMgr* sm = app->selectionMgr();
|
||||
if ( !sm ) return false;
|
||||
@ -257,7 +261,7 @@ bool STEPPlugin_GUI::exportSTEP( SUIT_Desktop* parent )
|
||||
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
GEOM_Operation transaction( app, stepOp.in() );
|
||||
GEOM_Operation transaction( app, stepOp.get() );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -37,10 +37,13 @@
|
||||
#include "GEOM_Operation.h"
|
||||
#include "GEOMBase.h"
|
||||
#include "GEOM_Displayer.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(STLPlugin)
|
||||
|
||||
typedef GEOM::GenericObjPtr<GEOM::ISTLOperations> STLOpPtr;
|
||||
|
||||
//=======================================================================
|
||||
// function : STLPlugin_GUI()
|
||||
// purpose : Constructor
|
||||
@ -109,8 +112,8 @@ bool STLPlugin_GUI::importSTL( SUIT_Desktop* parent )
|
||||
|
||||
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
|
||||
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STLPluginEngine" );
|
||||
GEOM::ISTLOperations_var stlOp = GEOM::ISTLOperations::_narrow( op );
|
||||
if ( CORBA::is_nil( stlOp ) ) return false;
|
||||
STLOpPtr stlOp = GEOM::ISTLOperations::_narrow( op );
|
||||
if ( stlOp.isNull() ) return false;
|
||||
|
||||
QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
|
||||
tr( "STL_FILES" ),
|
||||
@ -124,7 +127,7 @@ bool STLPlugin_GUI::importSTL( SUIT_Desktop* parent )
|
||||
foreach( QString fileName, fileNames )
|
||||
{
|
||||
SUIT_OverrideCursor wc;
|
||||
GEOM_Operation transaction( app, stlOp.in() );
|
||||
GEOM_Operation transaction( app, stlOp.get() );
|
||||
|
||||
try
|
||||
{
|
||||
@ -143,6 +146,7 @@ bool STLPlugin_GUI::importSTL( SUIT_Desktop* parent )
|
||||
entryList.append( so->GetID() );
|
||||
transaction.commit();
|
||||
GEOM_Displayer( study ).Display( main.in() );
|
||||
main->UnRegister();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -181,8 +185,8 @@ bool STLPlugin_GUI::exportSTL( SUIT_Desktop* parent )
|
||||
|
||||
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
|
||||
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STLPluginEngine" );
|
||||
GEOM::ISTLOperations_var stlOp = GEOM::ISTLOperations::_narrow( op );
|
||||
if ( CORBA::is_nil( stlOp ) ) return false;
|
||||
STLOpPtr stlOp = GEOM::ISTLOperations::_narrow( op );
|
||||
if ( stlOp.isNull() ) return false;
|
||||
|
||||
LightApp_SelectionMgr* sm = app->selectionMgr();
|
||||
if ( !sm ) return false;
|
||||
@ -215,7 +219,7 @@ bool STLPlugin_GUI::exportSTL( SUIT_Desktop* parent )
|
||||
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
GEOM_Operation transaction( app, stlOp.in() );
|
||||
GEOM_Operation transaction( app, stlOp.get() );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -35,10 +35,13 @@
|
||||
#include "GEOM_Operation.h"
|
||||
#include "GEOMBase.h"
|
||||
#include "GEOM_Displayer.h"
|
||||
#include "GEOM_GenericObjPtr.h"
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(VTKPlugin)
|
||||
|
||||
typedef GEOM::GenericObjPtr<GEOM::IVTKOperations> VTKOpPtr;
|
||||
|
||||
//=======================================================================
|
||||
// function : VTKPlugin_GUI()
|
||||
// purpose : Constructor
|
||||
@ -102,8 +105,8 @@ bool VTKPlugin_GUI::exportVTK( SUIT_Desktop* parent )
|
||||
|
||||
SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
|
||||
GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "VTKPluginEngine" );
|
||||
GEOM::IVTKOperations_var stlOp = GEOM::IVTKOperations::_narrow( op );
|
||||
if ( CORBA::is_nil( stlOp ) ) return false;
|
||||
VTKOpPtr vtkOp = GEOM::IVTKOperations::_narrow( op );
|
||||
if ( vtkOp.isNull() ) return false;
|
||||
|
||||
LightApp_SelectionMgr* sm = app->selectionMgr();
|
||||
if ( !sm ) return false;
|
||||
@ -132,16 +135,16 @@ bool VTKPlugin_GUI::exportVTK( SUIT_Desktop* parent )
|
||||
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
GEOM_Operation transaction( app, stlOp.in() );
|
||||
GEOM_Operation transaction( app, vtkOp.get() );
|
||||
|
||||
try
|
||||
{
|
||||
app->putInfo( tr( "GEOM_PRP_EXPORT" ).arg( fileName ) );
|
||||
transaction.start();
|
||||
|
||||
stlOp->ExportVTK( obj, fileName.toUtf8().constData(), deflection );
|
||||
vtkOp->ExportVTK( obj, fileName.toUtf8().constData(), deflection );
|
||||
|
||||
if ( stlOp->IsDone() )
|
||||
if ( vtkOp->IsDone() )
|
||||
{
|
||||
transaction.commit();
|
||||
}
|
||||
@ -150,7 +153,7 @@ bool VTKPlugin_GUI::exportVTK( SUIT_Desktop* parent )
|
||||
transaction.abort();
|
||||
SUIT_MessageBox::critical( parent,
|
||||
tr( "GEOM_ERROR" ),
|
||||
tr( "GEOM_PRP_ABORT" ) + "\n" + tr( stlOp->GetErrorCode() ) );
|
||||
tr( "GEOM_PRP_ABORT" ) + "\n" + tr( vtkOp->GetErrorCode() ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -280,13 +280,16 @@ bool XAOPlugin_ImportDlg::execute()
|
||||
{
|
||||
QStringList anEntryList;
|
||||
anEntryList << addInStudy(m_mainShape, m_mainShape->GetName());
|
||||
m_mainShape->UnRegister();
|
||||
for (int i = 0; i < subShapes->length(); i++)
|
||||
{
|
||||
addInStudy(subShapes[i].in(), subShapes[i]->GetName());
|
||||
subShapes[i]->UnRegister();
|
||||
}
|
||||
for (int i = 0; i < groups->length(); i++)
|
||||
{
|
||||
addInStudy(groups[i].in(), groups[i]->GetName());
|
||||
groups[i]->UnRegister();
|
||||
}
|
||||
for (int i = 0; i < fields->length(); i++)
|
||||
{
|
||||
@ -316,6 +319,7 @@ QString XAOPlugin_ImportDlg::addFieldInStudy( GEOM::GEOM_Field_ptr theField, GEO
|
||||
|
||||
SALOMEDS::SObject_var aSO =
|
||||
getGeomEngine()->AddInStudy(aStudyDS, theField, theField->GetName(), theFather);
|
||||
theField->UnRegister();
|
||||
|
||||
QString anEntry;
|
||||
if ( !aSO->_is_nil() ) {
|
||||
@ -331,6 +335,7 @@ QString XAOPlugin_ImportDlg::addFieldInStudy( GEOM::GEOM_Field_ptr theField, GEO
|
||||
QString stepName = (tr("XAOPLUGIN_STEP") + " %1 %2").arg( step->GetID() ).arg( step->GetStamp() );
|
||||
SALOMEDS::SObject_wrap aSOField =
|
||||
getGeomEngine()->AddInStudy( aStudyDS, step, stepName.toLatin1().constData(), theField );
|
||||
step->UnRegister();
|
||||
}
|
||||
|
||||
aSO->UnRegister();
|
||||
|
Loading…
Reference in New Issue
Block a user