{ "id": "78018", "key": "TIMOB-4896", "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": "12094", "description": "", "name": "Sprint 2012-02", "archived": true, "released": true, "releaseDate": "2012-01-29" }, { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" }, { "id": "12677", "description": "Release 1.8 Service Pack 1", "name": "Release 1.8.1", "archived": true, "released": true, "releaseDate": "2012-01-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-02-01T15:59:37.000+0000", "created": "2011-07-20T11:04:54.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "module_window", "parity", "qe-testadded" ], "versions": [ { "id": "11367", "description": "", "name": "Release 1.7.1", "archived": true, "released": true, "releaseDate": "2011-06-21" }, { "id": "11570", "description": "", "name": "Release 1.7.2", "archived": true, "released": true, "releaseDate": "2011-07-21" } ], "issuelinks": [ { "id": "14705", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "85275", "key": "TIMOB-7329", "fields": { "summary": "iOS: Ti.Window.close() infinite loops", "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": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-03-04T22:18:02.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 discovered that when opening a window quickly, firing an event, and closing it again, my application will sometimes completely crash. I've tested this when the window that is opening another window is part of a Tab group, and that makes the error occur more consistently, so the code I have provided is an example using a TabGroup.\r\n\r\n{code:javascript|title=bugs/app.js}\r\nTi.UI.setBackgroundColor('#000');\r\n\r\nvar tabGroup = Ti.UI.createTabGroup();\r\n\r\nvar win2 = Ti.UI.createWindow({\r\n title:'valueForUndefinedKey',\r\n backgroundColor:'red',\r\n url:'bugs/window_crash.js'\r\n});\r\nvar tab2 = Ti.UI.createTab({\r\n title:'undefinedKey',\r\n window:win2\r\n});\r\n\r\ntabGroup.addTab(tab2);\r\ntabGroup.open();\r\n{code}\r\n\r\n\r\n{code:javascript|title=bugs/window_crash.js}\r\nvar win;\r\n\r\nvar button = Titanium.UI.createButton({\r\n title: 'Show Window',\r\n width: 300,\r\n height: 40\r\n});\r\nbutton.addEventListener('click', function() {\r\n win = Titanium.UI.createWindow({\r\n fullscreen: true,\r\n backgroundColor: '#666',\r\n url: 'window_crash_subwindow.js'\r\n });\r\n win.addEventListener('ready', function() {\r\n // win.close causes an error only if called immediately after window is created\r\n win.close();\r\n });\r\n win.open();\r\n});\r\n\r\nvar label = Titanium.UI.createLabel({\r\n text: 'Press that button a few times and watch it crash',\r\n color: '#000',\r\n height: 'auto',\r\n bottom: 40\r\n});\r\n\r\nTitanium.UI.currentWindow.add(label);\r\nTitanium.UI.currentWindow.add(button);\r\n{code}\r\n\r\n{code:javascript|title=bugs/window_crash_subwindow.js}\r\nTi.UI.currentWindow.fireEvent('ready');\r\n{code}\r\n\r\n\r\nHere is the complete log of the application.\r\n{code}\r\n[INFO] One moment, building ...\r\n[DEBUG] Detecting modules in /Users/matthew/Projects/Titanium Studio Workspace/titanium_bugs/modules\r\n[DEBUG] Detecting modules in /Library/Application Support/Titanium/modules\r\n[INFO] Titanium SDK version: 1.7.2\r\n[INFO] iPhone Device family: universal\r\n[INFO] iPhone SDK version: 4.3\r\n[INFO] iPhone simulated device: iphone\r\n[DEBUG] executing command: /usr/bin/killall iPhone Simulator\r\n[DEBUG] No matching processes belonging to you were found\r\n[DEBUG] finding old log files\r\n[DEBUG] executing command: mdfind -onlyin /Users/matthew/Library/Application Support/iPhone Simulator/4.3 -name 70553166-5807-402d-bfcb-8243509b1723.log\r\n[INFO] Launching application in Simulator\r\n[INFO] Launched application in Simulator (11.64 seconds)\r\n[DEBUG] executing command: xcodebuild -version\r\n[DEBUG] Xcode 4.1\r\n[DEBUG] Build version 4B110\r\n[INFO] Found 4.3.2 patch installed\r\n[INFO] Application started\r\n\r\n[DEBUG] reading stylesheet from: /Users/matthew/Library/Application Support/iPhone Simulator/4.3.2/Applications/5A13E843-A139-4466-985E-EDC6FB65F270/titanium_bugs.app/stylesheet.plist\r\n\r\n[INFO] titanium_bugs/1.0 (1.7.2.97c3689)\r\n\r\n[DEBUG] App Spec: specified by path /Users/matthew/Projects/Titanium Studio Workspace/titanium_bugs/build/iphone/build/Debug-iphonesimulator/titanium_bugs.app\r\n[DEBUG] SDK Root: path=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk version=4.3 name=Simulator - iOS 4.3\r\n[DEBUG] using device family iphone\r\n[DEBUG] Session started\r\n[DEBUG] Session did end with error Error Domain=DTiPhoneSimulatorErrorDomain Code=1 \"The simulated application quit.\" UserInfo=0x100303560 {NSLocalizedDescription=The simulated application quit., DTiPhoneSimulatorUnderlyingErrorCodeKey=-1}\r\n[INFO] Application has exited from Simulator\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "iOS: Application crash when opening a window and firing an event immediately which in turn closes the window", "creator": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "* Titanium SDK version: 1.7.2.97c3689\r\n* Platform & version: iOS 4.3, XCode 4.1, OSX 10.7 (Lion)\r\n* Device Details: iOS simulator and iOS device\r\n* Host Operating System: OSX 10.7\r\n* Titanium Studio version: Titanium Studio, build: 1.0.2.201107130739", "comment": { "comments": [ { "id": "160322", "author": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Further to this, I have discovered that if this.window.close() is called very soon after the window is created, this behaviour typically happens. I found a workaround by waiting a split second and then calling close i.e. setTimeout(function() { window.close(); }, 1);\r\n\r\nUnfortunately I'm now experiencing this issue on a fireEvent call as well, even if I use the setTimeout workaround from above.\r\n\r\nSee http://developer.appcelerator.com/question/122908/uiwindow-0x6b1be40-valueforundefinedkey-this-class-is-not-key-value-coding-compliant-for-the-key-close#comment-91775 for a complete list of what is happening.\r\n\r\nBTW. I've tried this with 1.7.2 as well and the problem persists.", "updateAuthor": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-22T08:26:38.000+0000", "updated": "2011-07-22T08:26:38.000+0000" }, { "id": "160456", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Matthew\r\n\r\nPlease would you read the [Creating Good Use-cases|http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-CreatingGoodUsecases] and amend your ticket accordingly. Please use a sequential list of Titanium API calls in favor of custom functions.\r\n\r\nPlease use the wiki markup provided (edit your ticket, rather than add another comment).\r\n\r\nState the build date and hash of the Titanium SDK you have tested.\r\n\r\nState your mobile platform version, in the environment field.\r\n\r\nOnce this is corrected, we can progress this ticket.\r\n\r\nMany thanks", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-07-25T07:31:58.000+0000", "updated": "2011-07-25T07:31:58.000+0000" }, { "id": "160457", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Please observe the [Jira Ticket Checklist|http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AJiraTicketChecklist] when raising tickets.\r\n\r\nThanks", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-07-25T07:32:35.000+0000", "updated": "2011-07-25T07:32:35.000+0000" }, { "id": "161122", "author": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Paul\r\n\r\nSorry, was not aware of the protocol, so here goes:\r\n\r\nEnvironment:\r\n\r\nTitanium SDK version: 1.7.2 (I don't see where build date / hash comes from, I am using the version that was automatically installed by Titanium Studio when 1.7.2 was released a week or so ago). I see an [INFO] log saying something about 1.7.2.97c3689, is that what you need?\r\nPlatform & version: iOS 4.3, OSX 10.7 (Lion)\r\nDevice Details: iOS simulator and iOS device\r\nHost Operating System: OSX 10.7\r\nTitanium Studio version: Titanium Studio, build: 1.0.2.201107130739\r\n\r\nCode for app.js\r\n{code:javascript}\r\nvar win = Titanium.UI.createWindow({\r\n fullscreen: true,\r\n backgroundColor: '#666',\r\n url: 'value_for_undefined_key_subwindow.js'\r\n});\r\nwin.addEventListener('ready', function() {\r\n // win.close causes an error only if called immediately after window is created\r\n win.close();\r\n});\r\n\r\nvar button = Titanium.UI.createButton({\r\n title: 'Show Window',\r\n width: 300,\r\n height: 40\r\n});\r\nbutton.addEventListener('click', function() {\r\n win.open();\r\n});\r\n\r\nvar label = Titanium.UI.createLabel({\r\n text: 'Press that button a few times and watch it crash',\r\n color: '#000',\r\n height: 'auto',\r\n bottom: 40\r\n});\r\n\r\nTitanium.UI.currentWindow.add(label);\r\nTitanium.UI.currentWindow.add(button);\r\n{code}\r\n\r\nCode for value_for_undefined_key_subwindow.js\r\n\r\n{code:javascript}\r\nTitanium.UI.currentWindow.fireEvent('ready');\r\n{code}\r\n\r\nStrangely with this code example I have provided I have been unable to replicate the reporting of the valueForUndefinedKey exception that was thrown, however after you open the window a few times it will consistently crash with only the following message:\r\n\r\n{code}\r\n[DEBUG] Session started\r\n[DEBUG] Session did end with error Error Domain=DTiPhoneSimulatorErrorDomain Code=1 \"The simulated application quit.\" UserInfo=0x10061fd60 {NSLocalizedDescription=The simulated application quit., DTiPhoneSimulatorUnderlyingErrorCodeKey=-1}\r\n{code}\r\n\r\nI hope that will suffice.", "updateAuthor": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-29T07:57:00.000+0000", "updated": "2011-07-29T07:57:00.000+0000" }, { "id": "161639", "author": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "As I'm sure you will raise this as \"not working code\" too, please rename app.js to bug.js and use the following code for app.js.\r\n\r\n{code:javascript}\r\nvar win = Titanium.UI.createWindow({\r\n backgroundColor: '#FFF',\r\n url: 'bug.js'\r\n});\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-02T23:26:09.000+0000", "updated": "2011-08-02T23:26:09.000+0000" }, { "id": "161683", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Matthew\r\n\r\nWould you kindly correct the body of the ticket, and other fields, rather than add a comment. It makes it easier for the core devs.\r\n\r\nThanks", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-08-03T08:15:59.000+0000", "updated": "2011-08-03T08:15:59.000+0000" }, { "id": "161684", "author": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Fine Paul, I will update the initial post.\r\n\r\nThanks for being so unhelpful and making the process of reporting a bug in your product so difficult, time consuming and painful.", "updateAuthor": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-03T08:26:01.000+0000", "updated": "2011-08-03T08:26:01.000+0000" }, { "id": "161687", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-08-03T09:00:02.000+0000", "updated": "2011-08-03T09:00:02.000+0000" }, { "id": "161688", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Oops, I forgot to say, if the valueForUndefinedKey error is no longer reproducable, then would you also change the title to reflect the new issue?\r\n\r\nThanks", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-08-03T09:00:52.000+0000", "updated": "2011-08-03T09:00:52.000+0000" }, { "id": "161794", "author": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hopefully that is better now then.", "updateAuthor": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-04T00:38:05.000+0000", "updated": "2011-08-04T00:38:05.000+0000" }, { "id": "161797", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Matthew\r\n\r\nWindow creation in bugs/window_crash.js should be contained within the button event, so that it is destroyed correctly, otherwise your code will be unstable. Would you please try the following corrected code, and report back with the log if it still crashes?\r\n\r\nThanks\r\n\r\n\r\n{code:javascript|title=bugs/app.js}\r\nTi.UI.setBackgroundColor('#000');\r\n\r\nvar tabGroup = Ti.UI.createTabGroup();\r\n\r\nvar win2 = Ti.UI.createWindow({\r\n title:'valueForUndefinedKey',\r\n backgroundColor:'red',\r\n url:'bugs/window_crash.js'\r\n});\r\nvar tab2 = Ti.UI.createTab({\r\n title:'undefinedKey',\r\n window:win2\r\n});\r\n\r\ntabGroup.addTab(tab2);\r\ntabGroup.open();\r\n{code}\r\n\r\n\r\n{code:javascript|title=bugs/window_crash.js}\r\nvar button = Ti.UI.createButton({\r\n title: 'Show Window',\r\n width: 300,\r\n height: 40\r\n});\r\n\r\nvar label = Ti.UI.createLabel({\r\n text: 'Press that button a few times and watch it crash',\r\n color: '#000',\r\n height: 'auto',\r\n bottom: 40\r\n});\r\n\r\nTi.UI.currentWindow.add(label);\r\nTi.UI.currentWindow.add(button);\r\n\r\nbutton.addEventListener('click', function() {\r\n var win = Ti.UI.createWindow({\r\n fullscreen: true,\r\n backgroundColor: 'green',\r\n url: 'window_crash_subwindow.js'\r\n });\r\n win.open();\r\n\r\n win.addEventListener('ready', function() {\r\n win.close();\r\n });\r\n});\r\n{code}\r\n\r\n{code:javascript|title=bugs/window_crash_subwindow.js}\r\nTi.UI.currentWindow.fireEvent('ready');\r\n{code}", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-08-04T01:43:59.000+0000", "updated": "2011-08-04T01:43:59.000+0000" }, { "id": "161981", "author": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Paul\r\n\r\nFirstly, I am not sure I am clear on why I should have to recreate Windows every time. Surely the open() and close() methods are there so that you can reuse the resource? If you take a look at the documentation at [http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.Window-object](http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.Window-object) it says \"Unlike Views, Windows can be opened and closed and can have special display properties such as fullscreen or modal.\"\r\n\r\nEither way, I tried your code, and I get the same problem. Here is the actual code I used for bugs/window_crash.js. All the other code remains exactly the same.\r\n\r\n{code:javascript|title=bugs/window_crash.js}\r\nvar win;\r\n\r\nvar button = Titanium.UI.createButton({\r\n title: 'Show Window',\r\n width: 300,\r\n height: 40\r\n});\r\nbutton.addEventListener('click', function() {\r\n win = Titanium.UI.createWindow({\r\n fullscreen: true,\r\n backgroundColor: '#666',\r\n url: 'window_crash_subwindow.js'\r\n });\r\n win.addEventListener('ready', function() {\r\n // win.close causes an error only if called immediately after window is created\r\n win.close();\r\n });\r\n win.open();\r\n});\r\n\r\nvar label = Titanium.UI.createLabel({\r\n text: 'Press that button a few times and watch it crash',\r\n color: '#000',\r\n height: 'auto',\r\n bottom: 40\r\n});\r\n\r\nTitanium.UI.currentWindow.add(label);\r\nTitanium.UI.currentWindow.add(button);\r\n{code}", "updateAuthor": { "name": "matthew.oriordan", "key": "matthew.oriordan", "displayName": "Matthew O'Riordan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-05T03:56:58.000+0000", "updated": "2011-08-05T03:56:58.000+0000" }, { "id": "177655", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Behavior has changed where this no longer leads to a crash, but instead just doesn't fire the close() properly (the window isn't \"opened\" when the close() call occurs). We probably need a check to abort opening a window if close() is called during the process, or to reschedule it.\r\n\r\nBuild 1.9.0.c3fc109", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-29T16:15:41.000+0000", "updated": "2011-12-29T16:16:43.000+0000" }, { "id": "179913", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Fixed by PR https://github.com/appcelerator/titanium_mobile/pull/1212", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-01-19T13:13:55.000+0000", "updated": "2012-01-19T13:13:55.000+0000" }, { "id": "179952", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 1.9.0.v20120119134634 with iphone 3gs (4.3) - fixed", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-19T15:57:46.000+0000", "updated": "2012-01-19T15:57:46.000+0000" } ], "maxResults": 17, "total": 17, "startAt": 0 } } }