locked
catch an unhandled exception in sampleCB RRS feed

  • Question

  • Hello,

    I use MFC and C++.
    My graph looks like that: capture filter->sample grabber->renderer.
    I would like to catch an unhandled exception in the sampleCB.


    I do some image processing in the sampleCB function. By changing some value of (global) variable in the sampleCB through the dialog, some times unhandled exception (Acess violation writing location 0x056c173e) appears.
    I tried to catch the error with try{} and catch(...) but that doesn´t help. Why? I thought try{} and ctch{} will help in any case.
    Is there any chance to catch the error before it stops the whole appliction?
    I could stop the graph during the value change, but as the error appears very rarely, I prefere to keep it running! The reason is the effect on the screen is better while the graph is running.
    What options do I have?

    thanks
    Monday, November 16, 2009 12:34 AM

Answers

  • First of all, you should investigate why exactly you have the exception and fix the cause in first place (check call stack etc.). catch { ... } will be catching this kind of exceptions if you compile with /EHa switch.
    http://alax.info/blog/tag/directshow
    • Marked as answer by Mister-Zorg Monday, November 16, 2009 2:26 PM
    Monday, November 16, 2009 9:24 AM