radioman / WebRtc.NET

WebRTC for C# & C++/CLI
Other
419 stars 126 forks source link

AccessViolationException when disconnected twice #65

Open JaebumLee opened 7 years ago

JaebumLee commented 7 years ago

WebRtc.NET.ManagedConductor.!ManagedConductor() webrtc.net-master\webrtc.net\src\managed.cpp:line 377 WebRtc.NET.ManagedConductor.~ManagedConductor() webrtc.net-master\webrtc.net\src\managed.cpp:line 217 WebRtc.NET.ManagedConductor.Dispose(Boolean A_0) c:\program files (x86)\microsoft visual studio 14.0\vc\include\xatomic0.h:line 0 WebRtc.NET.ManagedConductor.Dispose() WebRtc.NET.Demo.WebRTCServer.<>c__DisplayClass19_1.b__0() WebRtc.NET-master\WebRtc.NET.Demo\WebRTCServer.cs:line 227 ...

[managed.cpp]

!ManagedConductor()
{
    // free unmanaged data
    if (cd != NULL)
    {
        delete cd;      // **crash here!!**         
    }
    cd = NULL;
}
gerrosc commented 6 years ago

got the same issue. Anybody got a fix for this?

mstader commented 6 years ago

Same issue here. Worked around it by changing the "using" of the WebRtcNative in WebRTCServer.cs to a try / catch (AccessViolationException e) without calling Dispose() on it in the finally block. I know this is ugly and should not be done, but it may work for you @gerrosc .