Salome HOME
PAL10297 - when object is deleted, references to it must be deleted only he is "remov...
authorasl <asl@opencascade.com>
Mon, 31 Oct 2005 08:25:17 +0000 (08:25 +0000)
committerasl <asl@opencascade.com>
Mon, 31 Oct 2005 08:25:17 +0000 (08:25 +0000)
src/VISUGUI/VisuGUI_Tools.cxx

index 86f6b65463e33252bdbb91f231cd06691ab02e95..72f28a92a471ace5a0a134e96b0c6a940cc9e536 100644 (file)
@@ -393,13 +393,15 @@ namespace VISU
                  _PTR(SObject)     theSObject)
   {
     SalomeApp_Study* study = GetAppStudy( theModule );
-    study->deleteReferencesTo( theSObject );
 
     _PTR(ChildIterator) aChildIter = theStudy->NewChildIterator(theSObject);
     for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
       _PTR(SObject) aChildSObject = aChildIter->Value();
-      study->deleteReferencesTo( aChildSObject );
+      
       CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject);
+      VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(aChildObj);
+      if( !CORBA::is_nil( aRemovableObject ) ) 
+       study->deleteReferencesTo( aChildSObject );
       ErasePrs(theModule, aChildObj);
     }
 
@@ -409,6 +411,7 @@ namespace VISU
 
       VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj);
       if (!CORBA::is_nil(aRemovableObject)) {
+       study->deleteReferencesTo( theSObject );
         aRemovableObject->RemoveFromStudy();
       }
     } else {
@@ -729,7 +732,7 @@ namespace VISU
     if (aResActor)
       return aResActor;
 
-    anVISUActor = PublishInView( theModule, thePrs );
+    //anVISUActor = PublishInView( theModule, thePrs );
     return anVISUActor;
   }