pb with explode and AcDbVoidPtrArray
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear All,
I have a pb with using explode and especialy with AcDbVoidPtrArray.
I upgrade my code from VS2008 to VS2010 and autocad 2011 and 2012.
And now when I execute this code I have a crash when the application try to free memory for the entitySet (AcDbVoidPtrArray). It's very strange because the same code works fine in VS2008 and AutoCad2010.
I tried to free and close all pointers but I still have the same pb.
The aim of this code is to find the crossing point between two lines (one of the two line is in a block). The result is ok (I found the point) but I have a Acad error :in acarray.h :
template <class T, class R>
AcArray<T,R>::~AcArray()
{
if (mpArray != NULL)
delete[] mpArray;
}
and then in free.c
oid __cdecl _free_base (void * pBlock)
{
int retval = 0;
if (pBlock == NULL)
return;
RTCCALLBACK(_RTC_Free_hook, (pBlock, 0));
retval = HeapFree(_crtheap, 0, pBlock);
if (retval == 0)
{
errno = _get_errno_from_oserr(GetLastError());
}
}
[Code begin]
AcDbEntity *pCurRefEnt;
AcGePoint3dArray TestintersectionPoints;
AcDbBlockReference *pBlockRef = AcDbBlockReference::cast (pEnt1);
if (pBlockRef != NULL)
{
AcDbVoidPtrArray entitySet;
// explode the block, this will return a load of pre-transfromed entities for our perusal
Acad::ErrorStatus es = pBlockRef->explode (entitySet);
// if it worked ok
if (es == Acad::eOk)
{
// loop round getting the intersection points
for (int i = 0; i < entitySet.length(); i++)
{
pCurRefEnt = (AcDbEntity*)entitySet.at(i);
if ((pCurRefEnt->isKindOf(AcDbLine::desc())) && (TestintersectionPoints.isEmpty()))
{
Acad::ErrorStatus es1 = pCurRefEnt->intersectWith (pEnt2, AcDb::kOnBothOperands, TestintersectionPoints);
}
pCurRefEnt->close();
delete pCurRefEnt;
}
TestintersectionPoints.setLogicalLength(0);
entitySet.setLogicalLength(0);
}
pBlockRef->close();
entitySet.removeAll();
pEnt2->close();
pEnt1->close();
}==> acad.exe error!!!
[Code End]

