I am getting this weird error where I get an access violation from reading private class-level values (no pointers).
HRESULT WindowedSinkRenderer::Initialize(IMLTeeSink3 *sink)
{
std::cout << "Test\n";
// exception throw here
std::cout << "Test" << _isInitialized << "\n";
std::cout << "Test\n";
return S_OK;
}
Here is my header
class WindowedSinkRenderer
{
public:
WindowedSinkRenderer();
~WindowedSinkRenderer();
HRESULT Initialize(IMLTeeSink3 *sink);
HRESULT Deinitialize();
HRESULT SetRenderOwner(HWND handle);
HRESULT SetRenderDimensions(int width, int height, bool fillVideo);
HRESULT GetCurrentImage(BITMAPINFOHEADER* bitmapHeader, BYTE** data, DWORD* size, bool* bufferHasInfoHeader);
private:
DWORD _remoteGraphRegister;
SmartPtr<IGraphBuilder> _graphBuilder;
SmartPtr<IFilterGraph2> _filterGraph;
SmartPtr<IMediaControl> _mediaControl;
WindowedVideoRenderer* _videoRenderer;
bool _isInitialized;
};
And here is my constructor where it event initializes the bool to false.
WindowedSinkRenderer::WindowedSinkRenderer() : _isInitialized(false)
{
}
What gives? Why the error?
0xC0000005: Access violation reading location 0xCDCDCDE1.
It looks like you are calling Initialize with an invalid pointer to a WindowedSinkRenderer object.