{ "id": "62607", "key": "TIMOB-1975", "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": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:57:42.000+0000", "created": "2011-04-15T03:07:00.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "defect" ], "versions": [], "issuelinks": [], "assignee": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2011-04-17T01:57:42.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

Attempting to show an error dialog inside the JS (our\ndoRhinoDialog in TiContext) FCs the app\nif the activity belonging to the context that is attempting to show\nthe dialog has finished.

\n

This can happen, for example, if a user backs out of a\nheavyweight window while a separate thread (like an XHR callback,\nwhich is how we found out about this problem) is running JS in that\nwindow's context and comes across an error.

\n

For a failcase, use this app.js and then win.js.

\n

app.js:

\n
\nTitanium.UI.setBackgroundColor('#000');\nTitanium.UI.createWindow({  \n    title:'Test',\n    backgroundColor:'#fff',\n    fullscreen: true,\n    url: 'win.js'\n}).open();\n
\n

win.js:

\n
\nvar win = Ti.UI.currentWindow;\nwin.addEventListener('close', function(){\n    Ti.API.info(win.nonsense.nonsense);\n});\n
\n

The FC is this exception:

\n
\nandroid.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@45d433c8 is not valid; is your activity running?\nat android.view.ViewRoot.setView(ViewRoot.java:509)\nat android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)\nat android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)\nat android.view.Window$LocalWindowManager.addView(Window.java:424)\nat android.app.Dialog.show(Dialog.java:241)\nat org.appcelerator.titanium.TiContext$1.run(TiContext.java:811)\nat android.os.Handler.handleCallback(Handler.java:587)\nat android.os.Handler.dispatchMessage(Handler.java:\n
{html}", "attachment": [], "flagged": false, "summary": "Android: Showing JS error dialog (rhino dialog) can FC app if activity has finished", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "127134", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

(from [480434de05223577f1903689349b567fd8cfccd7])\n[#1975 state:fixed-in-qa] Check if activity\nfinished/finishing before attempting to display dialog in it\n\nhttp://github.com/appcelerator/titanium_mobile/commit/480434de05223...

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T03:07:01.000+0000", "updated": "2011-04-15T03:07:01.000+0000" }, { "id": "127135", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

1.4.2.4ce7ff G1 running 1.6, 2.2 simulator

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:07:01.000+0000", "updated": "2011-04-15T03:07:01.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }