Salome HOME
Crash in the destructor with omniORB4
[modules/superv.git] / src / Supervision / SNode_Impl.cxx
index 6b9718c084fef5280efbeb0c1b3b96c64888224a..552ecb1d14ca5b4286b205be7b65d0fee6f11347 100644 (file)
@@ -1,18 +1,21 @@
-using namespace std;
-//=============================================================================
-// File      : SNode_Impl.cxx
-// Created   : 2003
-// Author    : Jean Rahuel
-// Project   : SALOME
-// $Header: 
-//=============================================================================
+//  SUPERV Supervision : contains the implementation of interfaces of SuperVision described in SUPERV.idl
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : SNode_Impl.cxx
+//  Author : Jean Rahuel
+//  Module : SUPERV
+//  $Header: 
 
+using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "SNode_Impl.hxx"
 
@@ -73,25 +76,38 @@ SNode_Impl::~SNode_Impl() {
 void SNode_Impl::destroy() {
   beginService( "SNode_Impl::Destroy" );
   if ( DataFlowEditor()->IsEditing() ) {
+    SUPERV::GNode_ptr aCoupled = SUPERV::GNode::_narrow( Coupled() ) ;
     if ( Delete() ) {
       _poa->deactivate_object(*_id) ;
-      CORBA::release(_poa) ;
+//      CORBA::release(_poa) ;
       delete(_id) ;
-      _thisObj->_remove_ref();
+//      _thisObj->_remove_ref();
+    }
+    else {
+      MESSAGE("SNode_Impl::destroy ERROR ") ;
+    }
+    if ( !CORBA::is_nil( aCoupled ) ) {
+//      aCoupled->SetCoupled( "" ) ; : Used in GraphBase::Graph::RemoveNode( EndSwitchNode ) :
+      aCoupled->destroy() ;
     }
+// Valid() only after deletion of the corresponding EndSwitchNode :
+    DataFlowEditor()->UnValid() ;
   }
   endService( "SNode_Impl::Destroy" );
 }
 
 bool SNode_Impl::Delete() {
-//  beginService( "SNode_Impl::Delete" );
+  beginService( "SNode_Impl::Delete" );
   bool RetVal = false ;
   if ( DataFlowEditor()->IsEditing() ) {
+    DeletePorts() ;
     RetVal = DataFlowEditor()->RemoveNode( Name() ) ;
-    if ( RetVal )
-      RetVal = DataFlowEditor()->IsValid() ;
+// Valid() only after deletion of the corresponding EndLoopNode :
+//    if ( RetVal ) {
+//      RetVal = DataFlowEditor()->IsValid() ;
+//    }
   }
-//  endService( "SNode_Impl::Delete" );
+  endService( "SNode_Impl::Delete" );
   return RetVal ;
 }