[AC-3056] Opening/closing the same windows sometimes causes a NullPointerException in Android
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2011-08-16T17:01:46.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | 1.6.2, 1.7, android, crash, window |
Reporter | Aleix Casagolda |
Assignee | Tony Guntharp |
Created | 2011-06-10T03:34:57.000+0000 |
Updated | 2016-03-08T07:48:06.000+0000 |
Description
I've found at least one case and I've written a simple app to demonstrate it.
A window with 2 buttons, each one opens a new window with a button to close. If the user opens/closes the windows several times, sometimes app crashes with a NullPointerException.
If the user opens always the same window, the app seems to do not crash. It seems too that if the user open/closes windows very fast works well and that if he/she waits some seconds before opening a new one after closing, tend to fail more frequently.
The code for the test application:
(ComponentName.java:75)
E/TiUncaughtHandler( 442): at android.content.Intent.(Intent.java:2702)
E/TiUncaughtHandler( 442): at ti.modules.titanium.ui.TiUIWindow.createIntent(TiUIWindow.java:539)
E/TiUncaughtHandler( 442): at ti.modules.titanium.ui.TiUIWindow.createNewActivity(TiUIWindow.java:197)
E/TiUncaughtHandler( 442): at ti.modules.titanium.ui.TiUIWindow.(TiUIWindow.java:110)
E/TiUncaughtHandler( 442): at ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:98)
E/TiUncaughtHandler( 442): at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:67)
E/TiUncaughtHandler( 442): at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:85)
E/TiUncaughtHandler( 442): at android.os.Handler.dispatchMessage(Handler.java:95)
E/TiUncaughtHandler( 442): at android.os.Looper.loop(Looper.java:123)
E/TiUncaughtHandler( 442): at android.app.ActivityThread.main(ActivityThread.java:3647)
E/TiUncaughtHandler( 442): at java.lang.reflect.Method.invokeNative(Native Method)
E/TiUncaughtHandler( 442): at java.lang.reflect.Method.invoke(Method.java:507)
E/TiUncaughtHandler( 442): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/TiUncaughtHandler( 442): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/TiUncaughtHandler( 442): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 442): FATAL EXCEPTION: main
E/AndroidRuntime( 442): java.lang.NullPointerException
E/AndroidRuntime( 442): at android.content.ComponentName.(ComponentName.java:75)
E/AndroidRuntime( 442): at android.content.Intent.(Intent.java:2702)
E/AndroidRuntime( 442): at ti.modules.titanium.ui.TiUIWindow.createIntent(TiUIWindow.java:539)
E/AndroidRuntime( 442): at ti.modules.titanium.ui.TiUIWindow.createNewActivity(TiUIWindow.java:197)
E/AndroidRuntime( 442): at ti.modules.titanium.ui.TiUIWindow.(TiUIWindow.java:110)
E/AndroidRuntime( 442): at ti.modules.titanium.ui.WindowProxy.handleOpen(WindowProxy.java:98)
E/AndroidRuntime( 442): at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:67)
E/AndroidRuntime( 442): at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:85)
E/AndroidRuntime( 442): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 442): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 442): at android.app.ActivityThread.main(ActivityThread.java:3647)
E/AndroidRuntime( 442): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 442): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 442): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 442): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 442): at dalvik.system.NativeStart.main(Native Method)
{noformat}
Titanium.UI.setBackgroundColor('#000');
var win1 = Titanium.UI.createWindow({
title:'Window 1'
});
win1.add(openButton = Titanium.UI.createButton({
title:'Open window 1',
top: 10
}));
win1.add(openButton2 = Titanium.UI.createButton({
title:'Open window 2',
top: 100
}));
openButton.addEventListener('click', function() {
modal.open();
});
openButton2.addEventListener('click', function() {
modal2.open();
});
var modal = Titanium.UI.createWindow({
title:'Modal',
modal: true
});
modal.add(closeButton = Titanium.UI.createButton({
title:'Close',
top: 100
}));
closeButton.addEventListener('click', function() {
modal.close();
});
var modal2 = Titanium.UI.createWindow({
title:'Modal 2',
modal: true
});
modal2.add(closeButton2 = Titanium.UI.createButton({
title:'Close',
bottom: 100
}));
closeButton2.addEventListener('click', function() {
modal2.close();
});
win1.open();
and the crash StackTrace:
{noformat}
E/TiUncaughtHandler( 442): (main) [15724,191549] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 1.6.2,2011/04/18 17:16,78906d
E/TiUncaughtHandler( 442): java.lang.NullPointerException
E/TiUncaughtHandler( 442): at android.content.ComponentName.
Aleix Your code contains a lot of errors. Please correct them, in order to progress this ticket. Also provide the link to the Q&A question that you raised regarding this issue, which is a pre-requisite of opening tickets. Please read [Submitting Bug Reports](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-SubmittingBugReports) before raising any further tickets. Thanks
No response from user
/sigh
Closing after 30 days of inactivity. Apologies for the copy/paste error! :/