I have a function that creates many custom objects, numerous times (if the user wants). I've used undo "begin" and "end" markers so that the user can undo each group.
However, if I (say) use my tool to create three groups then undo them all, after the third undo AutoCAD (2016) crashes with:
Exception thrown at 0x000007FEFD90A06D (KernelBase.dll) in acad.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131500, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x000007FEF8E30000). Unhandled exception at 0x000007FEFD90A06D (KernelBase.dll) in acad.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131500, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x000007FEF8E30000).
and call stack:
KernelBase.dll!000007fefd90a06d() Unknown clr.dll!000007fef8f0fcf1() Unknown clr.dll!000007fef8f0faf0() Unknown 000007fe99ec0291() Unknown Acmgd.ni.dll!000007fec78db71f() Unknown Acmgd.ni.dll!000007fec78da8fe() Unknown Acmgd.ni.dll!000007fec789157f() Unknown Acmgd.ni.dll!000007fec7891987() Unknown Acmgd.ni.dll!000007fec7935b73() Unknown AcLayer.ni.dll!000007fec20beae5() Unknown AcLayer.ni.dll!000007fec20bd22a() Unknown Acmgd.ni.dll!000007fec792209f() Unknown Acmgd.ni.dll!000007fec78d9d3d() Unknown clr.dll!000007fef8ea7c9e() Unknown acbol.dll!000007fedacae14e() Unknown acbol.dll!000007fedacbd1a4() Unknown accore.dll!000007fed2484eaf() Unknown accore.dll!000007fed291665f() Unknown acad.exe!000000014006bd2f() Unknown acad.exe!000000013fd98985() Unknown accore.dll!000007fed225d8ce() Unknown accore.dll!000007fed225d6e3() Unknown accore.dll!000007fed22324bb() Unknown accore.dll!000007fed2231c60() Unknown accore.dll!000007fed2231b18() Unknown accore.dll!000007fed21f3018() Unknown accore.dll!000007fed21b5e77() Unknown accore.dll!000007fed219b925() Unknown accore.dll!000007fed2a23218() Unknown accore.dll!000007fed225d738() Unknown acad.exe!000000013fda4169() Unknown mfc110u.dll!AfxWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 47 C++
Obviously, that isn't my code - any idea what the cause might be? Or how I might discover the cause?
Solved! Go to Solution.
Solved by Kyudos. Go to Solution.
This seems to come about if I create more than 256 new objects in one go. Is there some sort of transaction / database size limit I don't know about??
EDIT:
Actually - this smells like the open object for read limit....investigating...
I use transactions (almost) exclusively it turns out this was down to an iteration over the linetype table.
Inside the transaction I was using:
es = acdbOpenObject(pObj, id, AcDb::kForRead);
I fixed the problem by changing that to:
es = acdbTransactionManager->getObject(pObj, id, AcDb::kForRead);
So I'm happy it's now working ...but...
My recommendation is using smart pointers (such as AcDbObjectPointer):
AcDbObjectPointer<AcDbObject> pObj(id, AcDb::kForRead); if (pObj.openStatus() == Acad::eOk) { // Your code... }
pObj destructor call pObj->close() in any case.
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
I wasn't calling close, that was the problem. I didn't think it was necessary, since I was inside a transaction. Really, if the intention of the transaction system was to stop you having to remember to close your objects, then once a transaction is open, objects should be added to it however they are opened...