Skip to content

Commit

Permalink
Merge pull request #160 from oNaiPs/fix_ref_count_bugs
Browse files Browse the repository at this point in the history
Use closure syntax for weak and unowned vars.
  • Loading branch information
ibc committed Apr 14, 2016
2 parents fcca647 + 4a4ffd6 commit ac4e857
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 68 deletions.
12 changes: 6 additions & 6 deletions src/PluginRTCPeerConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class PluginRTCPeerConnection : NSObject, RTCPeerConnectionDelegate, RTCSessionD
let sdp = desc.objectForKey("sdp") as? String ?? ""
let rtcSessionDescription = RTCSessionDescription(type: type, sdp: sdp)

self.onSetDescriptionSuccessCallback = { () -> Void in
self.onSetDescriptionSuccessCallback = { [unowned self] () -> Void in
NSLog("PluginRTCPeerConnection#setLocalDescription() | success callback")

let data = [
Expand Down Expand Up @@ -175,7 +175,7 @@ class PluginRTCPeerConnection : NSObject, RTCPeerConnectionDelegate, RTCSessionD
let sdp = desc.objectForKey("sdp") as? String ?? ""
let rtcSessionDescription = RTCSessionDescription(type: type, sdp: sdp)

self.onSetDescriptionSuccessCallback = { () -> Void in
self.onSetDescriptionSuccessCallback = { [unowned self] () -> Void in
NSLog("PluginRTCPeerConnection#setRemoteDescription() | success callback")

let data = [
Expand Down Expand Up @@ -300,7 +300,7 @@ class PluginRTCPeerConnection : NSObject, RTCPeerConnectionDelegate, RTCSessionD
) {
NSLog("PluginRTCPeerConnection#RTCDataChannel_setListener()")

weak var pluginRTCDataChannel = self.pluginRTCDataChannels[dcId]
let pluginRTCDataChannel = self.pluginRTCDataChannels[dcId]

if pluginRTCDataChannel == nil {
return;
Expand Down Expand Up @@ -335,7 +335,7 @@ class PluginRTCPeerConnection : NSObject, RTCPeerConnectionDelegate, RTCSessionD
return
}

weak var pluginRTCDataChannel = self.pluginRTCDataChannels[dcId]
let pluginRTCDataChannel = self.pluginRTCDataChannels[dcId]

if pluginRTCDataChannel == nil {
return;
Expand All @@ -356,7 +356,7 @@ class PluginRTCPeerConnection : NSObject, RTCPeerConnectionDelegate, RTCSessionD
return
}

weak var pluginRTCDataChannel = self.pluginRTCDataChannels[dcId]
let pluginRTCDataChannel = self.pluginRTCDataChannels[dcId]

if pluginRTCDataChannel == nil {
return;
Expand All @@ -373,7 +373,7 @@ class PluginRTCPeerConnection : NSObject, RTCPeerConnectionDelegate, RTCSessionD
return
}

weak var pluginRTCDataChannel = self.pluginRTCDataChannels[dcId]
let pluginRTCDataChannel = self.pluginRTCDataChannels[dcId]

if pluginRTCDataChannel == nil {
return;
Expand Down
Loading

0 comments on commit ac4e857

Please sign in to comment.