Fixed crash when PCF is destroyed before DataChannel in ObjC
Bug: webrtc:9231 Change-Id: Ifad698b366be61d33ffca81cf4f8ca8aba2988a2 Reviewed-on: https://webrtc-review.googlesource.com/86040 Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Commit-Queue: Kári Helgason <kthelgason@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23771}
This commit is contained in:
committed by
Commit Bot
parent
33b61ee81e
commit
c75b35ab40
@ -9,6 +9,8 @@
|
||||
*/
|
||||
|
||||
#import <WebRTC/RTCConfiguration.h>
|
||||
#import <WebRTC/RTCDataChannel.h>
|
||||
#import <WebRTC/RTCDataChannelConfiguration.h>
|
||||
#import <WebRTC/RTCMediaConstraints.h>
|
||||
#import <WebRTC/RTCPeerConnection.h>
|
||||
#import <WebRTC/RTCPeerConnectionFactory.h>
|
||||
@ -60,4 +62,32 @@
|
||||
XCTAssertTrue(true, "Expect test does not crash");
|
||||
}
|
||||
|
||||
- (void)testDataChannelLifetime {
|
||||
@autoreleasepool {
|
||||
RTCConfiguration *config = [[RTCConfiguration alloc] init];
|
||||
RTCMediaConstraints *contraints =
|
||||
[[RTCMediaConstraints alloc] initWithMandatoryConstraints:@{} optionalConstraints:nil];
|
||||
RTCDataChannelConfiguration *dataChannelConfig = [[RTCDataChannelConfiguration alloc] init];
|
||||
|
||||
RTCPeerConnectionFactory *factory;
|
||||
RTCPeerConnection *peerConnection;
|
||||
RTCDataChannel *dataChannel;
|
||||
|
||||
@autoreleasepool {
|
||||
factory = [[RTCPeerConnectionFactory alloc] init];
|
||||
peerConnection =
|
||||
[factory peerConnectionWithConfiguration:config constraints:contraints delegate:nil];
|
||||
dataChannel =
|
||||
[peerConnection dataChannelForLabel:@"test_channel" configuration:dataChannelConfig];
|
||||
XCTAssertTrue(dataChannel != nil);
|
||||
[peerConnection close];
|
||||
peerConnection = nil;
|
||||
factory = nil;
|
||||
}
|
||||
dataChannel = nil;
|
||||
}
|
||||
|
||||
XCTAssertTrue(true, "Expect test does not crash");
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user