Fix memory leaks

This commit is contained in:
vsr 2009-09-21 12:54:44 +00:00
parent ee26d6488a
commit d068bb8b46
8 changed files with 62 additions and 76 deletions

View File

@ -411,21 +411,21 @@ bool TransformationGUI_MirrorDlg::execute (ObjectList& objects)
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
switch (getConstructorId()) {
case 0:
{
if (toCreateCopy) {
for (int i = 0; i < myObjects.length(); i++) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MirrorPointCopy(myObjects[i], myArgument);
anObj = anOper->MirrorPointCopy(myObjects[i], myArgument);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
}
else {
for (int i = 0; i < myObjects.length(); i++) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MirrorPoint(myObjects[i], myArgument);
anObj = anOper->MirrorPoint(myObjects[i], myArgument);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
@ -437,16 +437,14 @@ bool TransformationGUI_MirrorDlg::execute (ObjectList& objects)
{
if (toCreateCopy) {
for (int i = 0; i < myObjects.length(); i++) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MirrorAxisCopy(myObjects[i], myArgument);
anObj = anOper->MirrorAxisCopy(myObjects[i], myArgument);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
}
else {
for (int i = 0; i < myObjects.length(); i++) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MirrorAxis(myObjects[i], myArgument);
anObj = anOper->MirrorAxis(myObjects[i], myArgument);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
@ -458,16 +456,14 @@ bool TransformationGUI_MirrorDlg::execute (ObjectList& objects)
{
if (toCreateCopy) {
for (int i = 0; i < myObjects.length(); i++) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MirrorPlaneCopy(myObjects[i], myArgument);
anObj = anOper->MirrorPlaneCopy(myObjects[i], myArgument);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
}
else {
for (int i = 0; i < myObjects.length(); i++) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MirrorPlane(myObjects[i], myArgument);
anObj = anOper->MirrorPlane(myObjects[i], myArgument);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}

View File

@ -565,11 +565,12 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects)
GEOM::GEOM_Object_var anObj;
QStringList aParameters;
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
switch (getConstructorId()) {
case 0:
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MultiRotate1D(myBase, myVector, myNbTimes1);
anObj = anOper->MultiRotate1D(myBase, myVector, myNbTimes1);
if(!IsPreview())
aParameters<<GroupPoints->SpinBox_DX->text();
res = true;
@ -577,8 +578,7 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects)
break;
case 1:
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MultiRotate2D(myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2);
anObj = anOper->MultiRotate2D(myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2);
if(!IsPreview()) {
aParameters<<GroupDimensions->SpinBox_DX1->text();
aParameters<<GroupDimensions->SpinBox_DY1->text();
@ -592,7 +592,7 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects)
if (!anObj->_is_nil()) {
if(!IsPreview())
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
objects.push_back(anObj._retn());
}

View File

@ -670,11 +670,12 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
QStringList aParameters;
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
switch (getConstructorId()) {
case 0:
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU);
anObj = anOper->MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU);
if(!IsPreview()) {
aParameters<<GroupPoints->SpinBox_DX->text();
aParameters<<GroupPoints->SpinBox_DY->text();
@ -685,9 +686,9 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
case 1:
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU) &&
!CORBA::is_nil(myVectorV)) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MultiTranslate2D(myBase, myVectorU, myStepU, myNbTimesU,
myVectorV, myStepV, myNbTimesV);
anObj = anOper->MultiTranslate2D(myBase,
myVectorU, myStepU, myNbTimesU,
myVectorV, myStepV, myNbTimesV);
if(!IsPreview()) {
aParameters<<GroupDimensions->SpinBox_DX1->text();
aParameters<<GroupDimensions->SpinBox_DY1->text();
@ -701,7 +702,7 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
if (!anObj->_is_nil()) {
if(!IsPreview())
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
objects.push_back(anObj._retn());
}

View File

@ -292,10 +292,12 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() );
anObj = anOper->OffsetShapeCopy( myObjects[i], GetOffset() );
if ( !anObj->_is_nil() ) {
if(!IsPreview()) {
anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData());
@ -306,7 +308,7 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
}
else {
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShape( myObjects[i], GetOffset() );
anObj = anOper->OffsetShape( myObjects[i], GetOffset() );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
}

View File

@ -607,16 +607,15 @@ bool TransformationGUI_PositionDlg::execute (ObjectList& objects)
bool toCreateCopy = IsPreview() || Group1->CheckButton1->isChecked();
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
switch (getConstructorId()) {
case 0:
{
for (int i = 0; i < myObjects.length(); i++) {
if (toCreateCopy)
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
PositionShapeCopy(myObjects[i], myObjects[i], myEndLCS);
else
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
PositionShape(myObjects[i], myObjects[i], myEndLCS);
anObj = toCreateCopy ?
anOper->PositionShapeCopy(myObjects[i], myObjects[i], myEndLCS) :
anOper->PositionShape(myObjects[i], myObjects[i], myEndLCS);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
@ -628,11 +627,9 @@ bool TransformationGUI_PositionDlg::execute (ObjectList& objects)
{
for (int i = 0; i < myObjects.length(); i++) {
if (toCreateCopy)
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
PositionShapeCopy(myObjects[i], myStartLCS, myEndLCS);
else
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
PositionShape(myObjects[i], myStartLCS, myEndLCS);
anObj = toCreateCopy ?
anOper->PositionShapeCopy(myObjects[i], myStartLCS, myEndLCS) :
anOper->PositionShape(myObjects[i], myStartLCS, myEndLCS);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
@ -644,8 +641,7 @@ bool TransformationGUI_PositionDlg::execute (ObjectList& objects)
double aDistance = Group1->SpinBox_DX->value();
bool toReverse = Group1->CheckButton3->isChecked();
for (int i = 0; i < myObjects.length(); i++) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
PositionAlongPath(myObjects[i], myPath, aDistance, toCreateCopy, toReverse);
anObj = anOper->PositionAlongPath(myObjects[i], myPath, aDistance, toCreateCopy, toReverse);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}

View File

@ -537,6 +537,8 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
switch (getConstructorId()) {
case 0:
{
@ -545,11 +547,10 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
if (toCreateCopy) {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
RotateCopy(myObjects[i], myAxis, GetAngle() * PI180);
anObj = anOper->RotateCopy(myObjects[i], myAxis, GetAngle() * PI180);
if (!anObj->_is_nil()) {
if(!IsPreview()) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
objects.push_back(anObj._retn());
}
@ -558,11 +559,10 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
else {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
Rotate(myObjects[i], myAxis, GetAngle() * PI180);
anObj = anOper->Rotate(myObjects[i], myAxis, GetAngle() * PI180);
if (!anObj->_is_nil()) {
if(!IsPreview()) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
updateAttributes(anObj, aParameters);
}
objects.push_back(anObj._retn());
@ -577,8 +577,7 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
if (toCreateCopy) {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
RotateThreePointsCopy(myObjects[i], myCentPoint, myPoint1, myPoint2);
anObj = anOper->RotateThreePointsCopy(myObjects[i], myCentPoint, myPoint1, myPoint2);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
@ -586,8 +585,7 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects)
else {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
RotateThreePoints(myObjects[i], myCentPoint, myPoint1, myPoint2);
anObj = anOper->RotateThreePoints(myObjects[i], myCentPoint, myPoint1, myPoint2);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}

View File

@ -488,6 +488,8 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
switch (getConstructorId())
{
case 0:
@ -496,8 +498,7 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
{
for (int i = 0; i < myObjects.length(); i++)
{
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
ScaleShapeCopy(myObjects[i], myPoint, SpinBox_FX->value());
anObj = anOper->ScaleShapeCopy(myObjects[i], myPoint, SpinBox_FX->value());
if (!anObj->_is_nil()) {
if(!IsPreview())
anObj->SetParameters(SpinBox_FX->text().toLatin1().constData());
@ -509,8 +510,7 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
{
for (int i = 0; i < myObjects.length(); i++)
{
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
ScaleShape(myObjects[i], myPoint, SpinBox_FX->value());
anObj = anOper->ScaleShape(myObjects[i], myPoint, SpinBox_FX->value());
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
@ -523,16 +523,15 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
{
for (int i = 0; i < myObjects.length(); i++)
{
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
ScaleShapeAlongAxesCopy(myObjects[i], myPoint, SpinBox_FX->value(),
SpinBox_FY->value(), SpinBox_FZ->value());
anObj = anOper->ScaleShapeAlongAxesCopy(myObjects[i], myPoint, SpinBox_FX->value(),
SpinBox_FY->value(), SpinBox_FZ->value());
if (!anObj->_is_nil())
if(!IsPreview()) {
QStringList aParameters;
aParameters<<SpinBox_FX->text();
aParameters<<SpinBox_FY->text();
aParameters<<SpinBox_FZ->text();
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
objects.push_back(anObj._retn());
}
@ -541,9 +540,8 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects)
{
for (int i = 0; i < myObjects.length(); i++)
{
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
ScaleShapeAlongAxes(myObjects[i], myPoint, SpinBox_FX->value(),
SpinBox_FY->value(), SpinBox_FZ->value());
anObj = anOper->ScaleShapeAlongAxes(myObjects[i], myPoint, SpinBox_FX->value(),
SpinBox_FY->value(), SpinBox_FZ->value());
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}

View File

@ -554,6 +554,8 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
switch (getConstructorId()) {
case 0:
{
@ -569,11 +571,10 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
if (toCreateCopy) {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateDXDYDZCopy(myObjects[i], dx, dy, dz);
anObj = anOper->TranslateDXDYDZCopy(myObjects[i], dx, dy, dz);
if (!anObj->_is_nil()) {
if(!IsPreview())
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
objects.push_back(anObj._retn());
}
}
@ -581,11 +582,10 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
else {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateDXDYDZ(myObjects[i], dx, dy, dz);
anObj = anOper->TranslateDXDYDZ(myObjects[i], dx, dy, dz);
if (!anObj->_is_nil()) {
if(!IsPreview()) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
updateAttributes(anObj, aParameters);
}
objects.push_back(anObj._retn());
@ -600,8 +600,7 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
if (toCreateCopy) {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateTwoPointsCopy(myObjects[i], myPoint1, myPoint2);
anObj = anOper->TranslateTwoPointsCopy(myObjects[i], myPoint1, myPoint2);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
@ -609,8 +608,7 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
else {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateTwoPoints(myObjects[i], myPoint1, myPoint2);
anObj = anOper->TranslateTwoPoints(myObjects[i], myPoint1, myPoint2);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
@ -627,11 +625,10 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
double aDistance = GroupPoints->SpinBox3->value();
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
anObj = anOper->TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
if (!anObj->_is_nil()) {
if(!IsPreview()) {
anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
if (!toCreateCopy)
updateAttributes(anObj, aParameters);
}
@ -643,8 +640,7 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
if (toCreateCopy) {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateVectorCopy(myObjects[i], myVector);
anObj = anOper->TranslateVectorCopy(myObjects[i], myVector);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
@ -652,8 +648,7 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects)
else {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateVector(myObjects[i], myVector);
anObj = anOper->TranslateVector(myObjects[i], myVector);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}