unhandled exception during the process of deleting an exception

Hello
My program uses MFC. customers report that they see DrWatson from time to time. after debugging it I found that after catching a CDBException , an unhandled exception is thrown during the proccess of deleting this exception.
This is the relevant code:

TRY

{

m_db.ExecuteSQL( strCmd );

}

CATCH(CDBException, e)

{

PutLog(e->m_strError);

e->Delete(); // the unhandled exception is probably thrown from here

}

END_CATCH


am I doing somthing wrong here does someone saw this problem before

Thanks in advance...


Answer this question

unhandled exception during the process of deleting an exception

  • chrisuk2006

    There is not enough context to say what is going on. Start up the debugger, set a breakpoint on the catch block, and when the breakpoint is hit start stepping through the code. Doing this will show you why the application is crashing.

  • Michal Malecki

    Just a small clarification to my previues post:
    I didn't find a problem with deleting the exception altough it is auto deleting- this din't generate any exception.

  • Deltoid

    I am not able to debug from my box. the application was deployed on the customer box. what I was able to do is to try and analyze DrWatson dump file. while doing so I looked at the call stack window and saw the following sequence:

    AfxTryClean()...
    CException::Delete()
    input() 

    input executes the  TRY CATCH block I attached before.
    I can see that a CDBException was thrown b-coz I have it's msg in my application log file. but instad of deleting the exception and exiting normally the program crashes. combining this with the call stack window information , it looks like the proccess of deleting the exception (that starts in the statment e->Delete) generating an exception I don't catch and crashes the program.

    I wanted to know if this is a known bug, if anyone herd or saw somthing like this before.
    From what I understand , when using the TRY CATCH Macros instad of Try Catch, there is no need to delete the excetion and it will be auto deleted at the end of the CATCH block, so I thought that Deleting it before can cause some problems but I tired it in a small test program and it seems ok....

    Appriciate the help, Kfir


  • Siddu

    Try to use remote debugging. You just need to copy some files on the target machine and than you can start debugging.

  • unhandled exception during the process of deleting an exception