Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3015] Android: Syntax error hangs app when you choose "Kill"

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2012-03-25T08:49:35.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid, crash, defect
ReporterShawn Lipscomb
AssigneeShak Hossain
Created2012-02-20T12:25:54.000+0000
Updated2016-03-08T07:48:02.000+0000

Description

Problem

When you "Kill" an app after a syntax error occurs at runtime (the red/white error dialog), the screen goes black and the app hangs, instead of dying off. Clicking the Android "back" button at that point does nothing.

Testcase

Create a new mobile project and paste in the code that follows.

Run the app on the Android 2.2 emulator.

Press the "Next Window" button.

Press the "Cause error" button. As expected, this causes a red/white syntax error to occur.

Click the "Kill" button.

*The screen goes black and does not respond.*

To see a different result, change the {noformat}if (false){noformat} in Button1Click to {noformat}if (true){noformat} and run the app again.

Press the "Next Window" button. As expected, this causes a red/white syntax error to occur.

Click the "Kill" button.

You will see that this time, the app restarts itself (is it really supposed to do this, or is it supposed to just die off?).

Ti.UI.createWindow({url:'win1.js',
                    exitOnClose:true,
                    navBarHidden:true
                   }).open();
var win1=Ti.UI.currentWindow;

var Button1=Ti.UI.createButton({title:'Next Window'});
function Button1Click()
{
  if (false) // make this true to see a crash restart the app
    Button1.title=dne; // force a crash
  Ti.UI.createWindow({url:'win2.js',
                      exitOnClose:false,
                      navBarHidden:true
                     }).open();
}
Button1.addEventListener('click',Button1Click);
win1.add(Button1);
var CrashWin=Ti.UI.currentWindow;

var CrashButton=Ti.UI.createButton({title:'Cause error'});
function CrashButtonClick()
{
  CrashButton.title=dne; // force a crash
}
CrashButton.addEventListener('click',CrashButtonClick);
CrashWin.add(CrashButton);

Comments

  1. Shawn Lipscomb 2012-03-19

    Verified that this is fixed in SDK 2.0.0.v20120319003254.
  2. Shak Hossain 2012-03-25

    Customer confirmed the fix in 2.0

JSON Source