Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on XLFormTextFieldCell.m line 102 #1043

Open
liraz opened this issue Feb 10, 2019 · 2 comments
Open

Crash on XLFormTextFieldCell.m line 102 #1043

liraz opened this issue Feb 10, 2019 · 2 comments

Comments

@liraz
Copy link
Contributor

liraz commented Feb 10, 2019

Seems like memory for UITextfield delegate and target selector is not released.
Causing in the following crash:

Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x198edbdac object_isClass + 16
1  Foundation                     0x19a784928 KVO_IS_RETAINING_ALL_OBSERVERS_OF_THIS_OBJECT_IF_IT_CRASHES_AN_OBSERVER_WAS_OVERRELEASED_OR_SMASHED + 68
2  Foundation                     0x19a7820bc NSKeyValueWillChangeWithPerThreadPendingNotifications.llvm.16432713543580414412 + 304
3  UIKitCore                      0x1c71a2934 -[UITextField setDelegate:] + 120
4  XLForm                         0x1021da718 -[XLFormTextFieldCell update] (XLFormTextFieldCell.m:102)
5  XLForm                         0x1021e2bd0 -[XLFormViewController configureCell:] (XLFormViewController.m:587)
6  XLForm                         0x1021e2b6c -[XLFormViewController updateFormRow:] (XLFormViewController.m:579)
7  XLForm                         0x1021e3134 -[XLFormViewController tableView:cellForRowAtIndexPath:] (XLFormViewController.m:616)
8  UIKitCore                      0x1c70ccde4 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 684
9  UIKitCore                      0x1c70cd32c -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
10 UIKitCore                      0x1c7098a04 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2256
11 UIKitCore                      0x1c70b68f0 -[UITableView layoutSubviews] + 140
12 UIKitCore                      0x1c734b7dc -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1380
13 QuartzCore                     0x19e309b74 -[CALayer layoutSublayers] + 184
14 QuartzCore                     0x19e30eb2c CA::Layer::layout_if_needed(CA::Transaction*) + 324
15 QuartzCore                     0x19e26d44c CA::Context::commit_transaction(CA::Transaction*) + 340
16 QuartzCore                     0x19e29bd7c CA::Transaction::commit() + 608
17 UIKitCore                      0x1c6ecba3c _afterCACommitHandler + 256
18 CoreFoundation                 0x199c9c7cc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
19 CoreFoundation                 0x199c97460 __CFRunLoopDoObservers + 412
20 CoreFoundation                 0x199c97a00 __CFRunLoopRun + 1264
21 CoreFoundation                 0x199c971f0 CFRunLoopRunSpecific + 436
22 GraphicsServices               0x19bf10584 GSEventRunModal + 100
23 UIKitCore                      0x1c6ea2d40 UIApplicationMain + 212
24 EVgo                           0x100945e2c main (main.m:26)
25 libdyld.dylib                  0x199756bb4 start + 4

The KVO_IS_RETAINING_ALL_OBSERVERS_OF_THIS_OBJECT_IF_IT_CRASHES_AN_OBSERVER_WAS_OVERRELEASED_OR_SMASHED happens after few times of allocation and release of the XLForm rows.
and at some point the delegate still points to an older object and target listener is still there.

liraz added a commit to driivz/XLForm that referenced this issue Feb 10, 2019
@mats-claassen
Copy link
Member

Hi @liraz could you make a pull request with that fix?

liraz added a commit to driivz/XLForm that referenced this issue Feb 13, 2019
@liraz
Copy link
Contributor Author

liraz commented Feb 13, 2019

We had another similar crash that we can reproduce every day:

Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x234b03dac object_isClass + 16
1  Foundation                     0x2363ac928 KVO_IS_RETAINING_ALL_OBSERVERS_OF_THIS_OBJECT_IF_IT_CRASHES_AN_OBSERVER_WAS_OVERRELEASED_OR_SMASHED + 68
2  Foundation                     0x2363aa0bc NSKeyValueWillChangeWithPerThreadPendingNotifications.llvm.16432713543580414412 + 304
3  UIKitCore                      0x262dca934 -[UITextField setDelegate:] + 120
4  XLForm                         0x10409e668 -[XLFormTextFieldCell update] (XLFormTextFieldCell.m:105)
5  XLForm                         0x1040a6b08 -[XLFormViewController configureCell:] (XLFormViewController.m:593)
6  XLForm                         0x1040a6aa8 -[XLFormViewController updateFormRow:] (XLFormViewController.m:583)
7  XLForm                         0x1040a70e0 -[XLFormViewController tableView:cellForRowAtIndexPath:] (XLFormViewController.m:625)
8  UIKitCore                      0x262cf4de4 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 684
9  UIKitCore                      0x262cf532c -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
10 UIKitCore                      0x262cc0a04 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2256
11 UIKitCore                      0x262cde8f0 -[UITableView layoutSubviews] + 140
12 UIKitCore                      0x262f737dc -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1380
13 QuartzCore                     0x239f31b74 -[CALayer layoutSublayers] + 184
14 QuartzCore                     0x239f36b2c CA::Layer::layout_if_needed(CA::Transaction*) + 324
15 QuartzCore                     0x239e9544c CA::Context::commit_transaction(CA::Transaction*) + 340
16 QuartzCore                     0x239ec3d7c CA::Transaction::commit() + 608
17 UIKitCore                      0x262af3a3c _afterCACommitHandler + 256
18 CoreFoundation                 0x2358c47cc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
19 CoreFoundation                 0x2358bf460 __CFRunLoopDoObservers + 412
20 CoreFoundation                 0x2358bfa00 __CFRunLoopRun + 1264
21 CoreFoundation                 0x2358bf1f0 CFRunLoopRunSpecific + 436
22 GraphicsServices               0x237b38584 GSEventRunModal + 100
23 UIKitCore                      0x262acad40 UIApplicationMain + 212
24 *****                           0x10285199c main (main.m:26)
25 libdyld.dylib                  0x23537ebb4 start + 4

As stated before, the viewDidDisappear is not called sometimes due to some weird release.
Currently we could reproduce this only on one device with ios 12.1.0.

I hope my fix will solve this.
pull request already contains this commit: #1045

mats-claassen pushed a commit that referenced this issue Mar 25, 2019
* selectorCell display repair

Unable to display when value than apples first selectorOptions

* fixed crash

* fixed memory leaks

* Cell disappears while inline picker is open

* Fixes crash on update

* check object object equal

* codereview

* fixed memory leaks

* fixed memory leaks [2]

* updated logic

* fixed memory leaks

* fix for crash #1043

* fix for crash #1044

* fix for issue #1044

* fix for issue #1044

* fixed mistake

* fixed observation if lib uses in drawer controller

* fixed kvo crash

* reverted last fix

* cleanup

* fixed kvo

* fix for crash #1043

* reverted #1045 (comment)

* reverted #948

* fixed firstResponder logic

* codereview in Descriptors

* codereview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants