Hi,
In my ObjectARX application, I am trying to copy the entities from current drawing into a target drawing. For this, I am using AcDbDatabase::wblock function but it returns me error status as eVetoed. Following is extract of my code:
AcDbDatabase pFlatDb = new AcDbDatabase(true, true);
AcDbObjectIdArray tmpArray;
-- //some code to populate tmpArray
--
//pCurDb is current database
Acad::ErrorStatus es = pCurDb->wblock(pFlatDb, tmpArray, AcGePoint3d::kOrigin, AcDb::kDrcIgnore);
if(Acad::eOk != es)
{
acutPrintf(L"\nFailed to copy geometry into new drawing: %s", acadErrorStatusText(es));
delete pFlatDb;
return;
}
The application crashes at the line where I delete the target database (delete pFlatDb).
Am I doing something wrong here? What could be the reason for return status eVetoed and how to handle this situation so that crash does not occur?
Thanks in advance.
You don't say here what context your code is executing in when the problem occurs, but that is likely a factor. I recommend to try testing this code in a standard command handler function in a simple module with no reactors or other add-ons loaded, then add things until the error occurs.
try to lock current database at the beginning of your function.
#include <axlock.h>
...
AcAxDocLock docLock(pCurDb);