{ "id": "165329", "key": "TIMOB-24320", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-01-26T22:53:59.000+0000", "created": "2017-01-17T15:12:00.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [], "issuelinks": [ { "id": "56037", "type": { "id": "10122", "name": "Gantt: start-finish", "inward": "is triggered by", "outward": "is triggering" }, "outwardIssue": { "id": "170015", "key": "TIMOB-25391", "fields": { "summary": "iOS: TiUITable crashes app with a Zombie", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2017-10-15T08:31:08.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "I have an app with TableView with headerView or footerView specified. When you add this view into ScrollableView and removing it afterwards, it causes the app to crash with SIGABRT. It happens on both simulator and the device.\r\nHere is the crash log:\r\n\r\n{code}\r\nException Type: EXC_CRASH (SIGABRT)\r\nException Codes: 0x0000000000000000, 0x0000000000000000\r\nException Note: EXC_CORPSE_NOTIFY\r\nTermination Reason: Namespace OBJC, Code 0x1\r\nTriggered by Thread: 0\r\n\r\nFiltered syslog:\r\nNone found\r\n\r\nThread 0 name: Dispatch queue: com.apple.main-thread\r\nThread 0 Crashed:\r\n0 libsystem_kernel.dylib \t0x0000000180fd0d74 __abort_with_payload + 8\r\n1 libsystem_kernel.dylib \t0x0000000180fcd480 abort_with_payload_wrapper_internal + 100\r\n2 libsystem_kernel.dylib \t0x0000000180fcd41c abort_with_payload_wrapper_internal + 0\r\n3 libobjc.A.dylib \t0x0000000180a3bed8 _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 112\r\n4 libobjc.A.dylib \t0x0000000180a3be30 __objc_error + 0\r\n5 libobjc.A.dylib \t0x0000000180a4ecd4 weak_entry_insert(weak_table_t*, weak_entry_t*) + 0\r\n6 libobjc.A.dylib \t0x0000000180a542a8 objc_storeWeak + 328\r\n7 UIKit \t0x0000000187f097fc -[UIScrollView setDelegate:] + 336\r\n8 UIKit \t0x0000000187f357ec -[UITableView setDelegate:] + 368\r\n9 App \t0x000000010018518c -[TiUITableView tableView] (TiUITableView.m:0)\r\n10 App \t0x000000010018de88 __34-[TiUITableView proxyDidRelayout:]_block_invoke (TiUITableView.m:1750)\r\n11 libdispatch.dylib \t0x0000000180e8d200 _dispatch_call_block_and_release + 24\r\n12 libdispatch.dylib \t0x0000000180e8d1c0 _dispatch_client_callout + 16\r\n13 libdispatch.dylib \t0x0000000180e91d6c _dispatch_main_queue_callback_4CF + 1000\r\n14 CoreFoundation \t0x0000000181faff2c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12\r\n15 CoreFoundation \t0x0000000181fadb18 __CFRunLoopRun + 1660\r\n16 CoreFoundation \t0x0000000181edc048 CFRunLoopRunSpecific + 444\r\n17 GraphicsServices \t0x0000000183962198 GSEventRunModal + 180\r\n18 UIKit \t0x0000000187ec72fc -[UIApplication _run] + 684\r\n19 UIKit \t0x0000000187ec2034 UIApplicationMain + 208\r\n20 App \t0x000000010010a4d8 main (main.m:30)\r\n21 libdyld.dylib \t0x0000000180ec05b8 start + 4\r\n{code}\r\n\r\nI guess this happens after the TiUITableView is dealloc'ed and the headerViewProxy is still alive at that time. The app doesn't crash when you call [headerViewProxy setProxyObserver:nil] from -[TiUITableView dealloc].\r\n\r\nI have tried to create a simple example to describe this problem, but I have not successfully created one that reproduces the issue.\r\n", "attachment": [ { "id": "61270", "filename": "tableview-fix.patch", "author": { "name": "kasatani", "key": "kasatani", "displayName": "Shinya Kasatani", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-01-17T15:10:26.000+0000", "size": 445, "mimeType": "text/plain" } ], "flagged": false, "summary": "iOS: Removing a TableView with headerView may cause the app to crash", "creator": { "name": "kasatani", "key": "kasatani", "displayName": "Shinya Kasatani", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "kasatani", "key": "kasatani", "displayName": "Shinya Kasatani", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium SDK 6.0.0, iOS\r\n", "comment": { "comments": [ { "id": "404718", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, We need a sample code for us to verify the issue to apply a fix. Please provide one sample code that regenerates the issue. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-01-17T18:45:35.000+0000", "updated": "2017-01-17T18:45:35.000+0000" }, { "id": "404733", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey [~kasatani], your proposal looks pretty good so far. either the delegate or the property observer is making problems, so when you nil it, it won't call the delegate and therefore don't crash. Good catch! Do you want to do a PR to the open source project yourself or should we do one? \r\n\r\nAnd [~sdarda] is right, we still need a demo-code, so our QE can validate the possible fix. Thx!\r\n\r\n*EDIT*: This does not happen with Ti.UI.ListView as far as I can see ([gist|https://gist.github.com/hansemannn/5bcf6b1b2fde58da387ca902ae1d5bd2])\r\n*EDIT*: Same with Ti.UI.TableView, not reproducible ([gist|https://gist.github.com/hansemannn/a43b545566d064d308e3d111ddecdc8f])", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-17T19:52:13.000+0000", "updated": "2017-01-17T20:09:04.000+0000" }, { "id": "404740", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/8758\r\n\r\nTest-Case (will not always throw without the fix, but with the fix, it will never):\r\n{code:js}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Remove',\r\n top: 20,\r\n right: 20,\r\n height: 40,\r\n backgroundColor: 'black'\r\n});\r\n\r\nvar scrollable = Ti.UI.createScrollableView({\r\n showPagingControl: true,\r\n pagingControlColor: 'red'\r\n});\r\nvar list1 = Ti.UI.createTableView({\r\n backgroundColor: 'red', \r\n headerView: Ti.UI.createView({\r\n height: 50,\r\n backgroundColor: 'yellow'\r\n })\r\n});\r\n\r\nvar list2 = Ti.UI.createTableView({backgroundColor: 'green'});\r\nvar list3 = Ti.UI.createTableView({backgroundColor: 'blue'});\r\n\r\nscrollable.addView(list1);\r\nscrollable.addView(list2);\r\nscrollable.addView(list3);\r\n\r\nbtn.addEventListener('click', function() {\r\n btn.setEnabled(false);\r\n \r\n setInterval(function() {\r\n scrollable.removeView(list1);\r\n setTimeout(function() {\r\n scrollable.addView(list1);\r\n list1.setHeaderView(Ti.UI.createView({\r\n height: 50,\r\n backgroundColor: 'green'\r\n }));\r\n },1000);\r\n },1500)\r\n});\r\n\r\nwin.add(scrollable);\r\nwin.add(btn);\r\nwin.open();\r\n{code}\r\n\r\nNote: This test-case will trigger an add/remove loop, so we get more potential cases where it would crash.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-17T20:29:38.000+0000", "updated": "2017-01-17T20:29:38.000+0000" }, { "id": "404821", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~kasatani] I added some more changes in https://github.com/appcelerator/titanium_mobile/pull/8758 additional to yours, can you validate that this is this fine?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-18T23:24:36.000+0000", "updated": "2017-01-18T23:24:36.000+0000" }, { "id": "404834", "author": { "name": "kasatani", "key": "kasatani", "displayName": "Shinya Kasatani", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks for creating a PR! I have confirmed that this fixes the problem.\r\n", "updateAuthor": { "name": "kasatani", "key": "kasatani", "displayName": "Shinya Kasatani", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-01-19T02:41:18.000+0000", "updated": "2017-01-19T02:41:18.000+0000" }, { "id": "405435", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "FR passed, using:\r\nMacOS 10.12 (16A323)\r\nStudio 4.8.1.201612050850\r\nTi SDK 6.1.0\r\nAppc NPM 4.2.8\r\nAppc CLI 6.1.0\r\nAlloy 1.9.5\r\nXcode 8.2 (8C38)\r\nNo crash encountered when adding or removing a tableview with a headerview. Tested using the provided test case (left running for over a minute) and manually adding and removing the views.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-01-26T22:53:59.000+0000", "updated": "2017-01-26T22:53:59.000+0000" }, { "id": "405444", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified in SDK 6.1.0.v20170126150653", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-01-27T00:24:59.000+0000", "updated": "2017-01-27T00:24:59.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }