File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,12 @@ _swift_dispatch_release(dispatch_object_t obj) {
165
165
dispatch_release (obj);
166
166
}
167
167
168
+ SWIFT_CC (swift) DISPATCH_RUNTIME_STDLIB_INTERFACE
169
+ extern "C" void
170
+ _swift_dispatch_retain(dispatch_object_t obj) {
171
+ dispatch_retain (obj);
172
+ }
173
+
168
174
// DISPATCH_RUNTIME_STDLIB_INTERFACE
169
175
// extern "C" dispatch_queue_t
170
176
// _swift_apply_current_root_queue() {
Original file line number Diff line number Diff line change @@ -188,21 +188,20 @@ extension DispatchSource : DispatchSourceProcess,
188
188
189
189
internal class __DispatchData : DispatchObject {
190
190
internal let __wrapped : dispatch_data_t
191
- internal let __owned : Bool
192
191
193
192
final internal override func wrapped( ) -> dispatch_object_t {
194
193
return unsafeBitCast ( __wrapped, to: dispatch_object_t. self)
195
194
}
196
195
197
196
internal init ( data: dispatch_data_t , owned: Bool ) {
198
197
__wrapped = data
199
- __owned = owned
198
+ if !owned {
199
+ _swift_dispatch_retain ( unsafeBitCast ( data, to: dispatch_object_t. self) )
200
+ }
200
201
}
201
202
202
203
deinit {
203
- if __owned {
204
- _swift_dispatch_release ( wrapped ( ) )
205
- }
204
+ _swift_dispatch_release ( wrapped ( ) )
206
205
}
207
206
}
208
207
@@ -335,3 +334,6 @@ internal enum _OSQoSClass : UInt32 {
335
334
336
335
@_silgen_name ( " _swift_dispatch_release " )
337
336
internal func _swift_dispatch_release( _ obj: dispatch_object_t ) -> Void
337
+
338
+ @_silgen_name ( " _swift_dispatch_retain " )
339
+ internal func _swift_dispatch_retain( _ obj: dispatch_object_t ) -> Void
You can’t perform that action at this time.
0 commit comments