[TIMOB-7694] Android: Closing window with tableview and navBarHidden property set will result in NullPointerException
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-02-17T12:35:51.000+0000 |
Affected Version/s | Release 1.8.2 |
Fix Version/s | Sprint 2012-04, Release 2.0.0, Release 1.8.2 |
Components | Android |
Labels | 2.0.0, module_window, qe-testadded, regression |
Reporter | Justin Toth |
Assignee | Bill Dawson |
Created | 2012-02-15T15:38:33.000+0000 |
Updated | 2012-02-21T14:02:32.000+0000 |
Description
After upgrading from 1.8.1 to the latest CI build (2.0.0.v20120215111634), I am now receiving an error related to closing a window. If there is a TableView added to the window and the window has the navBarHidden property set (either to true or false), when closing that window it will cause a NullPointerException error.
D/AndroidRuntime(21347): Shutting down VM
W/dalvikvm(21347): threadid=1: thread exiting with uncaught exception (group=0x401b7760)
E/TiApplication(21347): (main) [1475,203564] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 2.0.0,2012/02/15 11:16,f358132
E/TiApplication(21347): java.lang.NullPointerException
E/TiApplication(21347): at ti.modules.titanium.ui.widget.tableview.TiTableView.onLayout(TiTableView.java:496)
E/TiApplication(21347): at android.view.View.layout(View.java:9601)
E/TiApplication(21347): at android.view.ViewGroup.layout(ViewGroup.java:3879)
E/TiApplication(21347): at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:382)
E/TiApplication(21347): at android.view.View.layout(View.java:9601)
E/TiApplication(21347): at android.view.ViewGroup.layout(ViewGroup.java:3879)
E/TiApplication(21347): at android.widget.FrameLayout.onLayout(FrameLayout.java:400)
E/TiApplication(21347): at android.view.View.layout(View.java:9601)
E/TiApplication(21347): at android.view.ViewGroup.layout(ViewGroup.java:3879)
E/TiApplication(21347): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1542)
E/TiApplication(21347): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1403)
E/TiApplication(21347): at android.widget.LinearLayout.onLayout(LinearLayout.java:1314)
E/TiApplication(21347): at android.view.View.layout(View.java:9601)
E/TiApplication(21347): at android.view.ViewGroup.layout(ViewGroup.java:3879)
E/TiApplication(21347): at android.widget.FrameLayout.onLayout(FrameLayout.java:400)
E/TiApplication(21347): at android.view.View.layout(View.java:9601)
E/TiApplication(21347): at android.view.ViewGroup.layout(ViewGroup.java:3879)
E/TiApplication(21347): at android.view.ViewRoot.performTraversals(ViewRoot.java:1286)
E/TiApplication(21347): at android.view.ViewRoot.handleMessage(ViewRoot.java:2063)
E/TiApplication(21347): at android.os.Handler.dispatchMessage(Handler.java:99)
E/TiApplication(21347): at android.os.Looper.loop(Looper.java:132)
E/TiApplication(21347): at android.app.ActivityThread.main(ActivityThread.java:4126)
E/TiApplication(21347): at java.lang.reflect.Method.invokeNative(Native Method)
E/TiApplication(21347): at java.lang.reflect.Method.invoke(Method.java:491)
E/TiApplication(21347): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
E/TiApplication(21347): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
Here is code to reproduce the issue:
//create window 1.
Ti.API.info("opening window 1");
var win = Ti.UI.createWindow({
backgroundColor: "#fff",
navBarHidden: true,
softInputMode: Ti.UI.Android.SOFT_INPUT_ADJUST_RESIZE,
exitOnClose: true
});
win.open();
var label = Ti.UI.createLabel({ text: "Window 1", width: "auto", height: "auto", top: 10 });
win.add(label);
var openWindow2Button = Ti.UI.createButton({ title: "Open Window 2", height: "auto", width: "auto", bottom: 10 });
openWindow2Button.addEventListener("click", function() {
//create window 2.
Ti.API.info("opening window 2");
var win2 = Ti.UI.createWindow({
backgroundColor: "#fff",
navBarHidden: true,//this causes crash on window 2 close!!
softInputMode: Ti.UI.Android.SOFT_INPUT_ADJUST_RESIZE,
exitOnClose: false
});
win2.open();
var label2 = Ti.UI.createLabel({ text: "Window 2", width: "auto", height: "auto", top: 10 });
win2.add(label2);
var closeWindow2Button = Ti.UI.createButton({ title: "Close Window 2", height: "auto", width: "auto", bottom: 10 });
closeWindow2Button.addEventListener("click", function() {
Ti.API.info("closing window 2");
win2.close();
});
win2.add(closeWindow2Button);
var table = Ti.UI.createTableView({ top: 60, bottom: 60, left: 0, right: 0, data: [] });
win2.add(table);
});
win.add(openWindow2Button);
Master pull request: https://github.com/appcelerator/titanium_mobile/pull/1451
1_8_X PR: https://github.com/appcelerator/titanium_mobile/pull/1453
Closing as Fixed. Note: Original fail case exists only in 2.0 beta. SDK: 1.8.2.v20120221114636 Android: V8 Studio: 1.0.9.201202131024 OS: Lion Devices Tested: Galaxy Tab 10.1 3.2, Amaze 2.3.4