Problem description
Setting 'borderWidth' for a window in a tabGroup crashes the App
Not reproducible with TiSDK 2.1.4 GA
Steps to reproduce:
Start from the KitchenSink BaseUIWindow.js
Add borderWidth: 0 in the self (window) definition as follows:
function BaseUIWindow(title) {
var self = Ti.UI.createWindow({
title:title,
backgroundColor:'white',
borderWidth : 0 // Add this line
});
The app will crash in the simulator and on the device with the following error:
[1028,1028] Sending event: exception on thread: main msg:java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.; Titanium 3.0.0,2012/12/12 18:49,a5894b3
[ERROR][TiApplication(13705)] java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
[ERROR][TiApplication(13705)] at android.view.ViewGroup.addViewInner(ViewGroup.java:3337)
[ERROR][TiApplication(13705)] at android.view.ViewGroup.addView(ViewGroup.java:3208)
[ERROR][TiApplication(13705)] at android.view.ViewGroup.addView(ViewGroup.java:3188)
[ERROR][TiApplication(13705)] at org.appcelerator.titanium.view.TiUIView.initializeBorder(TiUIView.java:953)
[ERROR][TiApplication(13705)] at org.appcelerator.titanium.view.TiUIView.processProperties(TiUIView.java:697)
[ERROR][TiApplication(13705)] at ti.modules.titanium.ui.widget.TiView.processProperties(TiView.java:49)
[ERROR][TiApplication(13705)] at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:893)
[ERROR][TiApplication(13705)] at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:310)
[ERROR][TiApplication(13705)] at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:107)
[ERROR][TiApplication(13705)] at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR][TiApplication(13705)] at android.os.Looper.loop(Looper.java:137)
[ERROR][TiApplication(13705)] at android.app.ActivityThread.main(ActivityThread.java:4514)
[ERROR][TiApplication(13705)] at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR][TiApplication(13705)] at java.lang.reflect.Method.invoke(Method.java:511)
[ERROR][TiApplication(13705)] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
[ERROR][TiApplication(13705)] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
[ERROR][TiApplication(13705)] at dalvik.system.NativeStart.main(Native Method)
Pull request https://github.com/appcelerator/titanium_mobile/pull/3752 If the view already has a parent, it needs to be removed before adding to the borderView. borderView is then added to the original parent. Tested the kitchensink sample, works without crash.
test case:
1. Run test case Expected result: Tabgroup opens without crashing Actual result: App crashes when opening tab group
backport PR https://github.com/appcelerator/titanium_mobile/pull/3809
App runs successfully and no crashes. Verified on: Google Nexus, android : 4.1 SDK version: 3.1.0.v20130220200300 CLI version : 3.0.24 OS : MAC OSX 10.7.5 XCode : 4.5.1