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>
if (mpArray != NULL)
and then in free.c
oid __cdecl _free_base (void * pBlock)
int retval = 0;
if (pBlock == NULL)
RTCCALLBACK(_RTC_Free_hook, (pBlock, 0));
retval = HeapFree(_crtheap, 0, pBlock);
if (retval == 0)
errno = _get_errno_from_oserr(GetLastError());
AcDbBlockReference *pBlockRef = AcDbBlockReference::cast (pEnt1);
if (pBlockRef != NULL)
// 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);
}==> acad.exe error!!!
Try not to "Close" the "pCurRefEnt"... It is an exploded entity, so it isn't database resident, therefore closing it doesn't make much sense. You should simply delete it as you do at the nd of the loop.
I hope it helps.
Developer Technical Services
Closing a non-DBR entity should be harmless. If this is the reason for the crash, then there is a bug in the object's implementation or related code.
I do confirm that removing the fact to close the pointer doesn't change anything.
I still have a crash when Acad try to release the mpArray of the entityset. Even if I do a removeall of the entityset and if I put logicallength to 0.
Perhaps if I could release the pointer (?) because Acad test if this pointer is !=Null, but of course this pointer is read only.
Thanks for your help, if you have another suggest, you are welcome.
Has anyone found a solution to this problem? I am experiencing very similar behaviour. I try to delete an entity from an AcDbVoidPtrArray of exploded entities and I get a crash. Entities that I am deleting are not database resident so according to documentation of explode() function, I should delete them myself.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.