here is the thing:
i have a constructor that calls a member function, the function throws an exception, i catch the exception in the constructor, free all dynamic allocated variables and then rethrow the exception

when i rethrow i get this:
Unhandled exception at 0x10210e32 (msvcr80d.dll) in Test.exe: 0xC0000005: Access violation reading location 0xcdcdcdc8.

and i'm stuck in dbgheap.c at line 1595

any help is welcomed, thx :)

Recommended Answers

All 4 Replies

did the program catch the execption that is thrown by the constructor? That's probably what cause that error

yes, i catch the exception in the program that calls the constructor.
the thing is the class that that the constructor belongs to is built in a static library, while the program that calls the constructor is built as an exe(different projects, same solution, vstudio 2005..blabla). don't know, could this be the problem?

>>could this be the problem?
probably not, afterall many win32 api functions are in static libraries and they don't have that problem.

Can you compiler that library for debug so that you can see what is causing the exception ?

>>i catch the exception in the constructor, free all dynamic allocated variables and then rethrow the exception
Is the exception handler attempting to delete (or free) pointers that have not yet been allocated ? Are all pointers initialized to 0 during program startup so that the exception handler can test to see if they need to be deallocated ?

it's ok, i found the problem.
had nothing to do with memory allocs, i forgot to include a header required for the exception i was throwing. the wierd thing is that i had no compile error, just this strange runtime error

thx for the help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.