{ "id": "63923", "key": "TIMOB-3291", "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": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" }, { "id": "12078", "description": "", "name": "Sprint 2011-38", "archived": true, "released": true, "releaseDate": "2011-09-26" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-11-05T15:39:54.000+0000", "created": "2011-04-15T03:41:29.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "branch-5062" ], "versions": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "issuelinks": [ { "id": "12787", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "80509", "key": "TIMOB-5337", "fields": { "summary": "iOS: Popover Crash when Switching Tabs", "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": "High", "id": "2" }, "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": "2011-11-05T15:39:54.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": "h1. Problem\r\nIf you click a button to display a popover from a UI Tab Bar item, but navigate away from the tab's page before the popover has a chance to display, the app will crash with the following error:\r\n\r\n\"Popovers cannot be presented from a UIBarButtonItem that is not in a toolbar or navigation bar already.\"\r\n\r\nh2. Steps to Reproduce\r\nDrop the following in an app.js. It will open a window in the tab group, close the window, try to display a popover, and then crash. No intervention is required by you.\r\n{code:title=app.js}\r\nvar tab, win;\r\nvar tabs = Ti.UI.createTabGroup();\r\ntabs.addTab(tab = Ti.UI.createTab({\r\n window: win = Ti.UI.createWindow()\r\n}));\r\ntabs.open();\r\n\r\nwin.addEventListener('open', cycle);\r\n\r\nfunction cycle() {\r\n var action = Ti.UI.createButton({\r\n title: 'Show Popover'\r\n });\r\n action.addEventListener('click', function(e) {\r\n Ti.UI.iPad.createPopover({\r\n width: 250, height: 100,\r\n title: 'Test Popover Crash'\r\n }).show({ view: action });\r\n });\r\n\r\n var child = Ti.UI.createWindow({\r\n rightNavButton: action\r\n });\r\n child.addEventListener('close', function() {\r\n \tsetTimeout(cycle, 1000);\r\n });\r\n tab.open(child);\r\n\r\n setTimeout(function() {\r\n action.fireEvent('click');\r\n }, 1000);\r\n setTimeout(function() {\r\n child.close();\r\n child.rightNavButton = null;\r\n }, 500);\r\n}\r\n{code}\r\n\r\nh2. Error\r\n{code:title=Console Log}\r\n2011-09-22 08:34:30.394 play[6948:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Popovers cannot be presented from a UIBarButtonItem that is not in a toolbar or navigation bar already.'\r\n\r\n*** Call stack at first throw:\r\n(\r\n\t0 CoreFoundation 0x024cbbe9 __exceptionPreprocess + 185\r\n\t1 libobjc.A.dylib 0x026205c2 objc_exception_throw + 47\r\n\t2 CoreFoundation 0x02484628 +[NSException raise:format:arguments:] + 136\r\n\t3 CoreFoundation 0x0248459a +[NSException raise:format:] + 58\r\n\t4 UIKit 0x00c467df -[UIPopoverController presentPopoverFromBarButtonItem:permittedArrowDirections:animated:] + 194\r\n\t5 play 0x0018a7d7 -[TiUIiPadPopoverProxy updatePopoverNow] + 263\r\n\t6 play 0x0018a600 -[TiUIiPadPopoverProxy show:] + 1824\r\n\t7 Foundation 0x006829a6 __NSThreadPerformPerform + 251\r\n\t8 CoreFoundation 0x024ad01f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15\r\n\t9 CoreFoundation 0x0240b28b __CFRunLoopDoSources0 + 571\r\n\t10 CoreFoundation 0x0240a786 __CFRunLoopRun + 470\r\n\t11 CoreFoundation 0x0240a240 CFRunLoopRunSpecific + 208\r\n\t12 CoreFoundation 0x0240a161 CFRunLoopRunInMode + 97\r\n\t13 GraphicsServices 0x0408b268 GSEventRunModal + 217\r\n\t14 GraphicsServices 0x0408b32d GSEventRun + 115\r\n\t15 UIKit 0x0091242e UIApplicationMain + 1160\r\n\t16 play 0x0000396a main + 410\r\n\t17 play 0x00002235 start + 53\r\n\t18 ??? 0x00000001 0x0 + 1\r\n\r\n)\r\n\r\nterminate called after throwing an instance of 'NSException'\r\n\r\n[DEBUG] Session did end with error (null)\r\n{code}", "attachment": [ { "id": "23021", "filename": "timob3291.rtf", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-22T10:11:23.000+0000", "size": 3131, "mimeType": "text/rtf" } ], "flagged": false, "summary": "iOS: Popover Crash when Navigating Back in Tab Group", "creator": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "environment": null, "comment": { "comments": [ { "id": "130488", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [1df642e2a3852b1d2035743be51cbfb64e1331cd])\n[#3291 state:fixed-in-qa] Display a warning and\nshort-circuit popover display when the presenting view isn't in the\ncurrent window. \nhttps://github.com/appcelerator/titanium_mobile/commit/1df642e2a385...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:41:30.000+0000", "updated": "2011-04-15T03:41:30.000+0000" }, { "id": "130489", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Tested with Titanium SDK version: 1.7.0 (03/08/11 09:53 1df642e)\non
\niPad 3.2
\niPad 4.3

{html}", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:41:30.000+0000", "updated": "2011-04-15T03:41:30.000+0000" }, { "id": "130490", "author": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "body": "{html}

This still happens in some contexts.

\n

Steps to reproduce: Add a popover to the rightNavButton ->\nClick to open -> click somewhere to close -> click to open,\netc.. If you do it fast enough on device it will crash with the\nfollowing stack trace: http://pastie.org/1704513

\n

It is important to note that it only happens if you are really\nfast or an app is doing some background processing so the popover\ndoesn't disappear right away. It's difficult to reproduce.

{html}", "updateAuthor": { "name": "rblalock", "key": "rblalock", "displayName": "Rick Blalock", "active": false, "timeZone": "America/Havana" }, "created": "2011-04-15T03:41:31.000+0000", "updated": "2011-04-15T03:41:31.000+0000" }, { "id": "166530", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "See Rick's comment above about why this is getting reopened.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-21T11:09:44.000+0000", "updated": "2011-09-21T11:09:44.000+0000" }, { "id": "166599", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "I updated the example to not require any interaction to reproduce the crash.", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-09-21T23:37:10.000+0000", "updated": "2011-09-21T23:37:10.000+0000" }, { "id": "166601", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Updated sample app.js to continuously open/close window, to make sure that the right nav button is always properly set even after being cleaned up.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-22T02:11:26.000+0000", "updated": "2011-09-22T02:11:26.000+0000" }, { "id": "166636", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Checked this against SDK in pull 486. On device, the sample code cycles and does not crash. Each cycle, the following appears in the log:\r\nSep 22 09:56:25 unknown UIKitApplication:com.appcelerator.timob3291[0x60e8][3368] : [WARN] Unable to display popover; view is not attached to the current window\r\n\r\nOn Simulator, the app and simulator terminate. Please see attached file for details.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-22T10:11:06.000+0000", "updated": "2011-09-22T10:11:06.000+0000" }, { "id": "166640", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Must be a timing issue. Doesn't crash for me on simulator, meaning there's still a race/scheduling issue in here somewhere. Probably going to have to throw in a lock.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-22T10:37:18.000+0000", "updated": "2011-09-22T10:37:18.000+0000" }, { "id": "166659", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Testing indicated that there's still a timing issue. Testing on device in a different app confirmed this. Reopening.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-22T12:07:50.000+0000", "updated": "2011-09-22T12:07:50.000+0000" }, { "id": "166661", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "These two tickets are both about popovers crashing in tab groups. A fix for this may fix the other, although the exceptions are different.", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-09-22T12:13:53.000+0000", "updated": "2011-09-22T12:13:53.000+0000" }, { "id": "166716", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Confirmed fixed by TIMOB-5337.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-23T00:18:05.000+0000", "updated": "2011-09-23T00:18:05.000+0000" }, { "id": "166813", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed with iPad (4.3.5) and iPad 2 (4.3.5).", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-09-23T13:15:58.000+0000", "updated": "2011-09-23T13:15:58.000+0000" }, { "id": "171664", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Standardizing summary and labels.", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-05T15:38:53.000+0000", "updated": "2011-11-05T15:38:53.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }