Commit c70f83f 1 parent b989605 commit c70f83f Copy full SHA for c70f83f
File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,23 @@ namespace RTC
163
163
// Ensure there is at least one IP:port binding.
164
164
if (this ->udpSockets .empty () && this ->tcpServers .empty ())
165
165
{
166
- delete this ;
166
+ // NOTE: We must manually delete above allocated objects. We cannot call `delete this`
167
+ // here since it would call the parent ~Transport destructor, and it would be called
168
+ // again after throwing the exception here.
169
+ //
170
+ // See: https://github.com/versatica/mediasoup/issues/222
171
+
172
+ this ->iceServer ->Destroy ();
173
+
174
+ for (auto * socket : this ->udpSockets )
175
+ {
176
+ socket->Destroy ();
177
+ }
178
+
179
+ for (auto * server : this ->tcpServers )
180
+ {
181
+ server->Destroy ();
182
+ }
167
183
168
184
MS_THROW_ERROR (" could not open any IP:port" );
169
185
}
You can’t perform that action at this time.
0 commit comments