CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2008
    Posts
    19

    acces violation while trying to catch an exception by reference

    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 try to rethrow it i get the following message:

    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 ideeas are welcomed , thx

  2. #2
    Join Date
    May 2007
    Location
    Scotland
    Posts
    1,164

    Re: acces violation while trying to catch an exception by reference

    Please post the code for the function that is causing the problem (i.e. the place where you re-throw at the very least). It sounds like you have deleted an object the reference is either directly or indirectly pointing to.

  3. #3
    Join Date
    Sep 2007
    Location
    poland|wrocław
    Posts
    47

    Re: acces violation while trying to catch an exception by reference

    Quote Originally Posted by kux
    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 try to rethrow it i get the following message:

    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 ideeas are welcomed , thx
    0xcdcdcdc8 <<--- im most cases this is an uninitialized variable memory pattern!

  4. #4
    Join Date
    Jan 2008
    Posts
    19

    Re: acces violation while trying to catch an exception by reference

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured