cplussharp / graph-studio-next

GraphStudioNext is a tool for developers to build and test DirectShow Graphs
355 stars 94 forks source link

Crash connecting to graph containing filter supporting IVideoWindow interface #333

Closed mikecopperwhite closed 5 years ago

mikecopperwhite commented 5 years ago

Steps

Expected : Connects to remote graph in instance A Actual : Sometimes succeeds connecting, sometimes crashes. Stopping on a breakpoint before the crash almost always avoids the crash.

The crashing call stack is inside a call to put_Caption with crash occur in marshalling code for BSTR (see code extract below).

Probably caused by passing a raw pointer to the string data in the local variable vw_name to put_Caption rather than a proper BSTR parameter. Works in local graphs by chance but call timing is different calling a remote graph.

  CComPtr<IVideoWindow>       vw;

hr = f->QueryInterface(IID_IVideoWindow, (void**)&vw); if (SUCCEEDED(hr)) { CString vw_name; vw_name = _T("ActiveMovie Window: ") + display_name; vw->put_Caption(vw_name.GetBuffer()); vw = NULL; }