A problem with destroy() of ~TColGeom_Array2OfBezierSurface()

Hello,
I'm blocked by a problem of deleting a array of BezierSurface. I was in the mode debug, the code are the following:

TColGeom_Array2OfBezierSurface tabSurf(1,nbvS,1,1);

///////////set values
Geom_BezierSurface BZ(array);
tabSurf.SetValue(1,1,&BZ);

Geom_BezierSurface BZP1(array);
T.SetRotation(ax,RotTotal);
BZP1.Transform(T);
tabSurf.SetValue(2,1,&BZP1);

Geom_BezierSurface BZP2(array);
T.SetRotation(ax,2*RotTotal);
BZP2.Transform(T);
tabSurf.SetValue(3,1,&BZP2);
.......
.......//here i set all the values of the array
.......//end of set values
/////////////////////////////////////////
GeomConvert_CompBezierSurfacesToBSplineSurface BB (tabSurf);

Geom_BSplineSurface BSPLSURF
( BB.Poles()->Array1(),BB.UKnots()->Array(), BB.VKnots()->Array1(),BB.UMultiplicities()->Array1(),BB.VMultiplicities()->Array1(),BB.UDegree(), BB.VDegree()) ;

return BSPLSURF;
//////end of the methode.
i was in the mode debug, and i found the error lies in the following function Destroy() which was called at the end of the methode: return BSPLSURF;

~TColGeom_Array2OfBezierSurface()
{
Destroy(); //here the error occured!!!!!!!
}

The debug told me : First-chance exception in Geometry.exe (NTDLL.DLL): 0xC0000008: Invalide Handle.
I don't know if it's my problem or a bug of opencascade, why i can't destroy the array "tabSurf" after use it.
Please help me!!!!! urgent

xiakeqin's picture

does anyone has some ideals?