{ "id": "93314", "key": "TIMOB-9745", "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": "13503", "description": "Sprint 2012-14 Core", "name": "Sprint 2012-14 API", "archived": true, "released": true, "releaseDate": "2012-07-13" }, { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-12-21T05:34:45.000+0000", "created": "2012-06-15T02:51:17.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "api", "module_searchbar", "qe-review", "qe-testadded" ], "versions": [ { "id": "13273", "description": "Release 2.0.2", "name": "Release 2.0.2", "archived": false, "released": true, "releaseDate": "2012-05-31" }, { "id": "13070", "description": "Release 1.8 Service Pack 2", "name": "Release 1.8.2", "archived": true, "released": true, "releaseDate": "2012-02-29" } ], "issuelinks": [ { "id": "18155", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "84536", "key": "TIMOB-7020", "fields": { "summary": "Android: Search bar in table causing crash", "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": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-11-06T19:22:57.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": "+Test Code+:\r\n\r\n//FirstView Component Constructor\r\n\r\nvar flag = false;\r\n\r\nfunction FirstView(win) {\r\n \r\n \r\n // Create a Button.\r\n var showHideButton = Ti.UI.createButton({\r\n title : 'Show / Hide',\r\n height : 75,\r\n width : '100%',\r\n top : 0,\r\n left : 0\r\n });\r\n \r\n // Listen for click events.\r\n showHideButton.addEventListener('click', function() {\r\n \r\n if(true == flag) {\r\n win.add(self);\r\n flag = false;\r\n } else {\r\n win.remove(self);\r\n flag = true;\r\n }\r\n });\r\n \r\n // Add to the parent view.\r\n win.add(showHideButton);\r\n \r\n\r\n\tvar self = Ti.UI.createView({\r\n\t top : 100,\r\n\t left : 0\r\n\t});\r\n\twin.add(self);\r\n\t\r\n\t\r\n\tvar sb = Titanium.UI.createSearchBar({\r\n barColor : '#122a6f',\r\n showCancel : false,\r\n height : 44, \r\n });\r\n\t\r\n\t// Create a TableView.\r\n\tvar aTableView = Ti.UI.createTableView({\r\n\t height : 600,\r\n\t width : '100%',\r\n\t search : sb,\r\n\t top : 0,\r\n\t left : 0\r\n\t});\r\n\t\r\n\t// Populate the TableView data.\r\n\tvar data = [\r\n\t\t{title:'Row 1', hasChild:true, color:'red', header:'First'},\r\n\t\t{title:'Row 2', hasDetail:true, color:'green'},\r\n\t\t{title:'Row 3', hasCheck:true, color:'blue', header:'Second'},\r\n\t\t{title:'Row 4', color:'orange'}\r\n\t];\r\n\taTableView.setData(data);\r\n\t\r\n\t// Listen for click events.\r\n\taTableView.addEventListener('click', function(e) {\r\n\t\talert('title: \\'' + e.row.title + '\\', section: \\'' + e.section.headerTitle + '\\', index: ' + e.index);\r\n\t});\r\n\t\r\n\t// Add to the parent view.\r\n\tself.add(aTableView);\r\n\t\r\n\treturn self;\r\n}\r\n\r\nmodule.exports = FirstView;\r\n\r\n\r\n\r\n+Test Case+:\r\n1. Launch the application\r\n2. Press the hide / show button to hide the table.\r\n3. Press it again to show the table.\r\n\r\n+Expected behavior+:\r\nThe table should get displayed again.\r\n\r\n+Actual Behavior+:\r\nThe application crashes with the following ADB log:\r\n\r\nD/AndroidRuntime( 3890): Shutting down VM\r\nW/dalvikvm( 3890): threadid=1: thread exiting with uncaught exception (group=0x40c451f8)\r\nE/TiApplication( 3890): (main) [6288,6382] Sending event: exception on thread: main msg:java.lang.IllegalStateException: The specified child already has a p\r\nt. You must call removeView() on the child's parent first.; Titanium 1.8.2,2012/02/23 17:46,59b3a90\r\nE/TiApplication( 3890): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.\r\nE/TiApplication( 3890): at android.view.ViewGroup.addViewInner(ViewGroup.java:3337)\r\nE/TiApplication( 3890): at android.view.ViewGroup.addView(ViewGroup.java:3208)\r\nE/TiApplication( 3890): at android.view.ViewGroup.addView(ViewGroup.java:3188)\r\nE/TiApplication( 3890): at ti.modules.titanium.ui.widget.TiUITableView.processProperties(TiUITableView.java:131)\r\nE/TiApplication( 3890): at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:641)\r\nE/TiApplication( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:464)\r\nE/TiApplication( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:456)\r\nE/TiApplication( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:434)\r\nE/TiApplication( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:471)\r\nE/TiApplication( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:456)\r\nE/TiApplication( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:434)\r\nE/TiApplication( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:538)\r\nE/TiApplication( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:271)\r\nE/TiApplication( 3890): at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:109)\r\nE/TiApplication( 3890): at ti.modules.titanium.ui.ActivityWindowProxy.handleMessage(ActivityWindowProxy.java:94)\r\nE/TiApplication( 3890): at android.os.Handler.dispatchMessage(Handler.java:95)\r\nE/TiApplication( 3890): at android.os.Looper.loop(Looper.java:137)\r\nE/TiApplication( 3890): at android.app.ActivityThread.main(ActivityThread.java:4507)\r\nE/TiApplication( 3890): at java.lang.reflect.Method.invokeNative(Native Method)\r\nE/TiApplication( 3890): at java.lang.reflect.Method.invoke(Method.java:511)\r\nE/TiApplication( 3890): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)\r\nE/TiApplication( 3890): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)\r\nE/TiApplication( 3890): at dalvik.system.NativeStart.main(Native Method)\r\nE/AndroidRuntime( 3890): FATAL EXCEPTION: main\r\nE/AndroidRuntime( 3890): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.\r\nE/AndroidRuntime( 3890): at android.view.ViewGroup.addViewInner(ViewGroup.java:3337)\r\nE/AndroidRuntime( 3890): at android.view.ViewGroup.addView(ViewGroup.java:3208)\r\nE/AndroidRuntime( 3890): at android.view.ViewGroup.addView(ViewGroup.java:3188)\r\nE/AndroidRuntime( 3890): at ti.modules.titanium.ui.widget.TiUITableView.processProperties(TiUITableView.java:131)\r\nE/AndroidRuntime( 3890): at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:641)\r\nE/AndroidRuntime( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:464)\r\nE/AndroidRuntime( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:456)\r\nE/AndroidRuntime( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:434)\r\nE/AndroidRuntime( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:471)\r\nE/AndroidRuntime( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:456)\r\nE/AndroidRuntime( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:434)\r\nE/AndroidRuntime( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:538)\r\nE/AndroidRuntime( 3890): at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:271)\r\nE/AndroidRuntime( 3890): at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:109)\r\nE/AndroidRuntime( 3890): at ti.modules.titanium.ui.ActivityWindowProxy.handleMessage(ActivityWindowProxy.java:94)\r\nE/AndroidRuntime( 3890): at android.os.Handler.dispatchMessage(Handler.java:95)\r\nE/AndroidRuntime( 3890): at android.os.Looper.loop(Looper.java:137)\r\nE/AndroidRuntime( 3890): at android.app.ActivityThread.main(ActivityThread.java:4507)\r\nE/AndroidRuntime( 3890): at java.lang.reflect.Method.invokeNative(Native Method)\r\nE/AndroidRuntime( 3890): at java.lang.reflect.Method.invoke(Method.java:511)\r\nE/AndroidRuntime( 3890): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)\r\nE/AndroidRuntime( 3890): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)\r\nE/AndroidRuntime( 3890): at dalvik.system.NativeStart.main(Native Method)\r\nW/ActivityManager( 1985): Force finishing activity r.intent.getComponent().flattenToShortString()\r\n\r\n+Others+:\r\nThe above code works fine if the search bar is removed.\r\n\r\n+Attachments+:\r\nThe source code has been attached.", "attachment": [ { "id": "28385", "filename": "FirstView.js", "author": { "name": "soumyakantikar", "key": "soumyakantikar", "displayName": "Soumya Kanti Kar", "active": true, "timeZone": "America/Havana" }, "created": "2012-06-15T02:51:17.000+0000", "size": 1587, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "Android: Searchbar crashes in tableView when adding and removing views", "creator": { "name": "soumyakantikar", "key": "soumyakantikar", "displayName": "Soumya Kanti Kar", "active": true, "timeZone": "America/Havana" }, "subtasks": [], "reporter": { "name": "soumyakantikar", "key": "soumyakantikar", "displayName": "Soumya Kanti Kar", "active": true, "timeZone": "America/Havana" }, "environment": "Titanium SDK Version 1.8.2\r\nPlatform OS: Android\r\nPlatform OS Version: 2.3.3 (GB), 4.0.3 (ICS)\r\nDevice details: Emulator, Samsung Galaxy S2\r\nHost Operating System: Windows 7\r\nTitanium Studio Build: 2.0.1.201204132053", "comment": { "comments": [ { "id": "200004", "author": { "name": "btran", "key": "btran", "displayName": "Betty Tran", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The bug was reproduced using Titanium SDKs 1.8.2, 2.0.1 and 2.0.2GA.\r\n\r\nh3. Code used to reproduce the issue\r\n\r\n{code}\r\nvar flag =false;\r\n\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'white'\r\n});\r\n\r\nvar data = [{\r\n\ttitle : 'Row 1',\r\n\thasChild : true,\r\n\tcolor : 'red',\r\n\theader : 'First'\r\n}, {\r\n\ttitle : 'Row 2',\r\n\thasDetail : true,\r\n\tcolor : 'green'\r\n}, {\r\n\ttitle : 'Row 3',\r\n\thasCheck : true,\r\n\tcolor : 'blue',\r\n\theader : 'Second'\r\n}, {\r\n\ttitle : 'Row 4',\r\n\tcolor : 'orange'\r\n}];\r\n\r\nvar sb = Titanium.UI.createSearchBar({\r\n\tbarColor : '#122a6f',\r\n\tshowCancel : false,\r\n\theight : 44,\r\n});\r\n\r\n// Create a TableView.\r\nvar table = Ti.UI.createTableView({\r\n\theight : 600,\r\n\twidth : '100%',\r\n\tsearch : sb,\r\n\ttop : 75,\r\n\tleft : 0,\r\n\tdata : data\r\n});\r\n\r\nwin.add(table);\r\n\r\nvar button = Ti.UI.createButton({\r\n\ttitle : 'Show / Hide',\r\n\theight : 75,\r\n\twidth : '100%',\r\n\ttop : 0,\r\n\tleft : 0\r\n});\r\n\r\nwin.add(button);\r\n\r\nbutton.addEventListener('click', function() {\r\n\r\n\t\tif (true == flag) {\r\n\t\t\twin.add(table);\r\n\t\t\tflag = false;\r\n\t\t} else {\r\n\t\t\twin.remove(table);\r\n\t\t\tflag = true;\r\n\t\t}\r\n\t});\r\n\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "btran", "key": "btran", "displayName": "Betty Tran", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-25T03:34:20.000+0000", "updated": "2012-06-25T03:34:20.000+0000" }, { "id": "200513", "author": { "name": "soumyakantikar", "key": "soumyakantikar", "displayName": "Soumya Kanti Kar", "active": true, "timeZone": "America/Havana" }, "body": "Wanted to provide in additional details. If instead of adding and removing the view, the view is made to show and hide, then the crash issue is not observed.", "updateAuthor": { "name": "soumyakantikar", "key": "soumyakantikar", "displayName": "Soumya Kanti Kar", "active": true, "timeZone": "America/Havana" }, "created": "2012-06-27T02:25:13.000+0000", "updated": "2012-06-27T02:25:13.000+0000" }, { "id": "214232", "author": { "name": "tsmolich", "key": "tsmolich", "displayName": "Tamila Smolich", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as fixed.\r\nTested and verified on:\r\nTitanium Studio, build: 2.1.1.201208091713\r\nTitanium SDK, build: 2.2.0.v20120810194112\r\nDevices: Nexus 7 tab (4.1), HTC Evo (4.0.3), Android Emulator (2.2)", "updateAuthor": { "name": "tsmolich", "key": "tsmolich", "displayName": "Tamila Smolich", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-13T17:11:58.000+0000", "updated": "2012-08-13T17:11:58.000+0000" }, { "id": "217954", "author": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Re-opening to edit label", "updateAuthor": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-09-07T03:52:57.000+0000", "updated": "2012-09-07T03:52:57.000+0000" }, { "id": "278481", "author": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Anvil testcase PR\n\nhttps://github.com/appcelerator/titanium_mobile/pull/4758\n", "updateAuthor": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-06T19:22:57.000+0000", "updated": "2013-11-06T19:22:57.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }