[TIMOB-28413] iOS: intermittent crash on TableView INSET_GROUPED test
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2021-04-29T16:58:39.000+0000 |
| Affected Version/s | Release 10.0.0 |
| Fix Version/s | Release 10.0.0 |
| Components | iOS |
| Labels | n/a |
| Reporter | Christopher Williams |
| Assignee | Vijay Singh |
| Created | 2021-04-05T14:31:27.000+0000 |
| Updated | 2021-04-29T16:58:39.000+0000 |
Description
Our unit test suite is crashing frequently after the addition of the TableView.INSET_GROUPED test. It's crashing on iPhone, iPad, and macOS. Here is the test in question: https://github.com/appcelerator/titanium_mobile/blob/master/tests/Resources/ti.ui.tableview.test.js#L1786-L1815
Attachments
| File | Date | Size |
|---|---|---|
| mocha_2021-03-31-070518_macos-lepew.crash | 2021-04-05T14:35:48.000+0000 | 190836 |
| mocha_2021-03-31-090948_macos-eve.crash | 2021-04-05T14:34:52.000+0000 | 190923 |
Looks like a threading issue. Here is the line causing the crash:
I never used- (void)updateRow:(TiUITableViewAction *)action { OSAtomicTestAndClearBarrier(NEEDS_UPDATE_ROW, &dirtyRowFlags); [table dispatchAction:action]; }OSAtomicTestAndClearBarrier, but there must be a better solutionSegfaults are typically caused by using a null/nil pointer or wild pointer. The
tablemember variable in theupdateRow()method is missing anilcheck like the rest of the code. So, we probably just need to do this...- (void)updateRow:(TiUITableViewAction *)action { if (table != nil) { OSAtomicTestAndClearBarrier(NEEDS_UPDATE_ROW, &dirtyRowFlags); [table dispatchAction:action]; } }In objective c, passing message to nil (calling method on an object which is nil) is valid. It'll do nothing and not even crash.
PR - https://github.com/appcelerator/titanium_mobile/pull/12706
merged to master and 10_0_X branch (post-RC, but pre-GA) for target 10.0.0 release.