Skip to content

Commit 41bbb0a

Browse files
Unowned self reference crashed on iOS 13 (#2008)
1 parent 5406bdb commit 41bbb0a

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<MacroExpansion>
31+
<BuildableReference
32+
BuildableIdentifier = "primary"
33+
BlueprintIdentifier = "51729E191B9A54F1004A00EB"
34+
BuildableName = "Example.app"
35+
BlueprintName = "Example"
36+
ReferencedContainer = "container:Example.xcodeproj">
37+
</BuildableReference>
38+
</MacroExpansion>
3039
<Testables>
3140
<TestableReference
3241
skipped = "NO">
@@ -39,17 +48,6 @@
3948
</BuildableReference>
4049
</TestableReference>
4150
</Testables>
42-
<MacroExpansion>
43-
<BuildableReference
44-
BuildableIdentifier = "primary"
45-
BlueprintIdentifier = "51729E191B9A54F1004A00EB"
46-
BuildableName = "Example.app"
47-
BlueprintName = "Example"
48-
ReferencedContainer = "container:Example.xcodeproj">
49-
</BuildableReference>
50-
</MacroExpansion>
51-
<AdditionalOptions>
52-
</AdditionalOptions>
5351
</TestAction>
5452
<LaunchAction
5553
buildConfiguration = "Debug"
@@ -71,8 +69,6 @@
7169
ReferencedContainer = "container:Example.xcodeproj">
7270
</BuildableReference>
7371
</BuildableProductRunnable>
74-
<AdditionalOptions>
75-
</AdditionalOptions>
7672
</LaunchAction>
7773
<ProfileAction
7874
buildConfiguration = "Release"

Source/Core/RowType.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ extension RowType where Self: BaseRow {
202202
*/
203203
@discardableResult
204204
public func onChange(_ callback: @escaping (Self) -> Void) -> Self {
205-
callbackOnChange = { [unowned self] in callback(self) }
205+
callbackOnChange = { [weak self] in callback(self!) }
206206
return self
207207
}
208208

@@ -213,7 +213,7 @@ extension RowType where Self: BaseRow {
213213
*/
214214
@discardableResult
215215
public func cellUpdate(_ callback: @escaping ((_ cell: Cell, _ row: Self) -> Void)) -> Self {
216-
callbackCellUpdate = { [unowned self] in callback(self.cell, self) }
216+
callbackCellUpdate = { [weak self] in callback(self!.cell, self!) }
217217
return self
218218
}
219219

@@ -224,7 +224,7 @@ extension RowType where Self: BaseRow {
224224
*/
225225
@discardableResult
226226
public func cellSetup(_ callback: @escaping ((_ cell: Cell, _ row: Self) -> Void)) -> Self {
227-
callbackCellSetup = { [unowned self] (cell: Cell) in callback(cell, self) }
227+
callbackCellSetup = { [weak self] (cell: Cell) in callback(cell, self!) }
228228
return self
229229
}
230230

@@ -235,7 +235,7 @@ extension RowType where Self: BaseRow {
235235
*/
236236
@discardableResult
237237
public func onCellSelection(_ callback: @escaping ((_ cell: Cell, _ row: Self) -> Void)) -> Self {
238-
callbackCellOnSelection = { [unowned self] in callback(self.cell, self) }
238+
callbackCellOnSelection = { [weak self] in callback(self!.cell, self!) }
239239
return self
240240
}
241241

@@ -246,13 +246,13 @@ extension RowType where Self: BaseRow {
246246
*/
247247
@discardableResult
248248
public func onCellHighlightChanged(_ callback: @escaping (_ cell: Cell, _ row: Self) -> Void) -> Self {
249-
callbackOnCellHighlightChanged = { [unowned self] in callback(self.cell, self) }
249+
callbackOnCellHighlightChanged = { [weak self] in callback(self!.cell, self!) }
250250
return self
251251
}
252252

253253
@discardableResult
254254
public func onRowValidationChanged(_ callback: @escaping (_ cell: Cell, _ row: Self) -> Void) -> Self {
255-
callbackOnRowValidationChanged = { [unowned self] in callback(self.cell, self) }
255+
callbackOnRowValidationChanged = { [weak self] in callback(self!.cell, self!) }
256256
return self
257257
}
258258
}

0 commit comments

Comments
 (0)