ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FATA error when saving custom object

7 REPLIES 7
Reply
Message 1 of 8
SAJalali
666 Views, 7 Replies

FATA error when saving custom object

Hi.

I have derived an object from AcDbEntity. whenever the save command is issued in debug time, I get this exception :

"First-chance exception at 0x000007fefd6faa7d in acad.exe: Microsoft C++ exception: _com_error at memory location 0x2c2fea00.."

the callStack breaks at:

>    KernelBase.dll!000007fefd6faa7d()     

and dissassembly at this:

"000007FEFD6FAA7D 48 81 C4 C8 00 00 00 add         rsp,0C8h "

The problem leads to this error when running autoCAD out of debugging environment:

"FATAL ERROR: Unhandled Access violation reading 0xffffffff exception at 77521e02h"

I have put break points at dwgOutFields() method of the custom class and the exception occurres after passing the control to the caller.

 

Thank you in advance.Smiley Happy

7 REPLIES 7
Message 2 of 8
owenwengerd
in reply to: SAJalali

It's not clear why you think the _com_error exception is related to the fatal error. Set your debugger to break at the access violation exception, then check the call stack to find the context within your code where the exception occurs.

--
Owen Wengerd
ManuSoft
Message 3 of 8
SAJalali
in reply to: owenwengerd

Thanks Owen for your reply.

I set the debugger to break at access violation through: "debug->exceptions->win32 exceptions->c000005 access violation" but the debugger did not break. Actually the program is built in debug version. When I run it directly from AutoCAD the fatal error window appears. however, debugging with all the exceptionsturnes on leads only to the exception I mentioned before and the error window does not come up in autoCAD.

The output window shows the same exception too.

I forgot to say I am using objectARX 2012 with visual studio 2010. I have a class derived from AcDbEntity which itself is parent of 6 more classes that overwrite som of the methods.

 

Thank you.

Message 4 of 8
SAJalali
in reply to: SAJalali

It should be added that I am working in windows7 64-bit.

 

Thanks and Regards

Message 5 of 8

Do I understand correctly that you are using:
1) ObjectARX 2012
2) AutoCAD 2012
3) VS 2010 without installed VS 2008 SP1?
If so, then you will not work without VS 2008 SP1.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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
Expert Elite Member

Message 6 of 8

If the bug is not evident in your debug build, then you have to debug your release build instead. Add debug information to your release build to make it easier.

--
Owen Wengerd
ManuSoft
Message 7 of 8
SAJalali
in reply to: owenwengerd

Thank you all for your kind helps.

After removing all components and sequentially assembling them testing the program after adding each library, I finally found the error cause. In a routine -which was written long time ago when I was so beginner and the program was still too small- I had allocated memory dynamically to a string and returned the pointer to the new string. However, deallocating the memory by the caller was omitted in the program. calling the routine times and times in each dwgOutFields() call, accumulatedly used up the stack. A problem in which AutoCAD seems to suffer from extra sensitivity as some other posts comply too.

About the _com_error, it still persists to come up but the fatal error has been solved.

 

Thank you again

Alireza

 

Message 8 of 8
Balaji_Ram
in reply to: SAJalali

Hi Alireza,

 

Such issues are hard to spot. Here are few suggestions :

 

1. Check to see if you have left any AutoCAD entities without closing them. Although you might be thinking that the error is during saving it could well be from an db operation performed earlier. Watch this recording :

http://through-the-interface.typepad.com/through_the_interface/2007/10/autocad-10-easy.html

You may find some clue if it is similar to what your app does. It is mainly to do with .Net API but some concepts are relevant to OARX.

 

2. As you said your class is the base class to several other classes. Narrow down on which entity is causing the save to fail. This might require some iterations to figure out.

 

3. Since you have mentioned that it does not crash when in debug mode, resort to logging messages. Use "acutPrintf" in places to track the flow before the crash happens.

 

Hope it helps.

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost