filterdirectshowaccess-violationsamplegrabber

How to to make sure the Sample Grabber filter won't generate any more callbacks when shutting down my DirectShow filter graph?


I have a DirectShow application written in Delphi 6 using the DSPACK component library. When I shut down my filter graphs (stop play), I get an access violation due to a callback from the Sample Grabber DirectShow filter occurring after the object that owns the callback method has been destroyed. It doesn't happen every time, but fairly often. Can someone point me to a code sample or document that tells me the steps I need to take to shut down my graphs in a way that that makes sure all pending Sample Grabber callbacks have been received or eliminated?


Solution

  • What about issuing ISampleGrabber::SetCallback(NULL, ... prior to stopping/releasing the filter graph?

    More to this, you can set an internal flag indicating termination and check it in the callbacks you have to immeditely return without further processing.