I'm writing a WebRTC client in C++. It needs to work cross platform. I'm starting with a POC on Windows. I can connect and disconnect to/from the example peerconnection_server.exe.
Per the Microsoft "getting started" tutorial (https://learn.microsoft.com/en-us/winrtc/getting-started), I'm using the WebRTC "M84" release.
I'm aware of this similar SO post, but it is not the same issue, so please don't point me to that: WebRTC crash at line webrtc::PeerConnectionInterface::RTCConfiguration config; for Native Linux application That's a constructor matter on Linux. My problem is the destructor on Windows... (clearly that class must have flaws in general..)
Getting to the point, I've found that I can't ever destroy a webrtc::PeerConnectionInterface::RTCConfiguration
object. If I do, a fatal error is produced saying something about the app writing to the heap in some illegal manner. It makes no difference how or when I use that class - it always blows up on destruction. All one needs to do test this is the following:
webrtc::PeerConnectionInterface::RTCConfiguration *config
= new webrtc::PeerConnectionInterface::RTCConfiguration();
delete config;
On the delete
line - kaboom!
I've found assorted examples of this config class being used. No one looks to have any such issues, and don't appear to be jumping through hoops to deal with this. Typically, one of those objects is created when a PeerConnection is, and then just allowed to scope out of a local function. Considering it's a "config" object, it ought to be rather benign - but apparently not!
What secret trick is involved here?
Looking at the source, the definition of the default constructor & destructors are maximally trivial. So, is the bug in some member object in the config?
PeerConnectionInterface::RTCConfiguration::RTCConfiguration() = default;
...
PeerConnectionInterface::RTCConfiguration::~RTCConfiguration() = default;