From 97e23d5542e31d58e57425e8673c413ae7c09b46 Mon Sep 17 00:00:00 2001
From: MSV <>
Date: Thu, 28 Apr 2011 15:37:01 +0000
Subject: [PATCH] OCC22403 Avoid long recursion in the method
 Transfer_Binder::CutResult

---
 src/Transfer/Transfer_Binder.cxx | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/Transfer/Transfer_Binder.cxx b/src/Transfer/Transfer_Binder.cxx
index 6a911f260c..c37f9aae38 100755
--- a/src/Transfer/Transfer_Binder.cxx
+++ b/src/Transfer/Transfer_Binder.cxx
@@ -61,7 +61,7 @@ void  Transfer_Binder::AddResult (const Handle(Transfer_Binder)& next)
   if (thenextr.IsNull()) 
     thenextr = next;
   else {
-    //Modification of requrcive to cycle
+    //Modification of recursive to cycle
     Handle(Transfer_Binder) theBinder = thenextr;
     while( theBinder != next ) { 
       if( theBinder->NextResult().IsNull() ) {
@@ -72,7 +72,7 @@ void  Transfer_Binder::AddResult (const Handle(Transfer_Binder)& next)
         theBinder = theBinder->NextResult();
     }
   }
-  //former requrcive
+  //former recursive
   // if (thenextr.IsNull()) thenextr = next;
   // else if (thenextr == next) return;
   // else thenextr->AddResult (next);
@@ -87,7 +87,16 @@ void  Transfer_Binder::CutResult (const Handle(Transfer_Binder)& next)
 {
   if (thenextr.IsNull()) return;
   if (thenextr == next) thenextr.Nullify();
-  else thenextr->CutResult (next);
+  //else thenextr->CutResult (next);
+  else {
+    Handle(Transfer_Binder) currBinder = thenextr, currNext;
+    while( !( (currNext = currBinder->NextResult()) == next ) ) {
+      if( currNext.IsNull() )
+        return;
+      currBinder = currNext;
+    }
+    currBinder->CutResult(next);
+  }
 }
 
 //=======================================================================