{ "id": "173426", "key": "TIMOB-26961", "fields": { "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "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": "20412", "name": "Release 8.1.0", "archived": false, "released": true, "releaseDate": "2019-08-13" } ], "resolution": { "id": "10000", "description": "", "name": "Done" }, "resolutiondate": "2019-04-08T04:04:24.000+0000", "created": "2019-04-02T02:17:12.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [ { "id": "19882", "name": "Release 8.0.0", "archived": false, "released": true, "releaseDate": "2019-03-14" } ], "issuelinks": [ { "id": "57479", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "173124", "key": "TIMOB-26899", "fields": { "summary": "Windows : Application Crash - In Background Mode", "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": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2019-04-08T04:04:24.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": "12642", "name": "Windows", "description": "Windows authoring support" } ], "description": "Currently HttpClient may be garbege-collected before its callback is fired under some circumstances if you don't save HttpClient instance from garbage collector. In that case application crashes. We might want to save HttpClient instance from garbage collection by protecting its instance until {{onerror}} or {{onload}} callback is called.\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: 'green'\r\n});\r\n\r\nwin.addEventListener('open', function () {\r\n var _tmpURL = \"https://docs.appcelerator.com/platform/latest/#!/api/\"\r\n var _tmpClient = Ti.Network.createHTTPClient({\r\n onload: function (e) {\r\n alert('Loaded');\r\n },\r\n onerror: function (e) {\r\n alert(\"Error:\" + e.error);\r\n },\r\n timeout: 30000\r\n });\r\n _tmpClient.open(\"GET\", _tmpURL);\r\n _tmpClient.send();\r\n\r\n // In this case _tmpClient may be garbage-collected as soon as this function is finished.\r\n // We could think this as \"logical\" failure but I think Titanium developers tend to use HttpClient like this.\r\n});\r\n\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "Windows: Save HttpClient instance until callback is fired", "creator": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 1124, "state": "closed", "name": "2019 Sprint 8", "startDate": "2019-03-31T18:03:00.000Z", "endDate": "2019-04-12T18:03:00.000Z", "completeDate": "2019-04-12T19:04:50.175Z", "originBoardId": 114 } ], "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }