Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2011] Opening new modal window with JS error will crash the app

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-05-25T17:50:05.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.7.0, Sprint 2011-20
ComponentsiOS
Labelscrash, ios, javascript, modal, release-1.7.0
ReporterAlex Le
AssigneeStephen Tramer
Created2011-04-15T03:08:01.000+0000
Updated2011-05-25T17:50:05.000+0000

Description

If opening a new modal window via a new javascript file, and this javascript file has errors, the iPhone emulator would crash. The reason why is that the red alert window is animating on top of the modal animation at the same time, thus would run into animation exception and crash the emulator.

For example,

var editWin = Ti.UI.createWindow( { url: 'edit.js', title: "Edit", backgroundColor: 'white' } ); editWin.open({ modal: true, modalStyle: Ti.UI.iPhone.MODAL_PRESENTATION_PAGESHEET, navBarHidden: true });

If the "edit.js" has an error, like a null reference exception, the app would crash. The stacktrace would be something like this ...

ERROR] Script Error = Can't find variable: contactByIds at edit.js (line 68).
2010-10-05 17:01:21.458 Marrily[8996:207] Assertion failure in -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:], /SourceCache/UIKit_Sim/UIKit-1262.60.3/UIWindowController.m:182
[ERROR] The application has crashed with an unhandled exception. Stack trace: 0 CoreFoundation 0x03807b7c exceptionPreprocess + 156
1 libobjc.A.dylib 0x0395740e objc_exception_throw + 47
2 CoreFoundation 0x037c0238 +[NSException raise:format:arguments:] + 136
3 Foundation 0x0062ae37 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x00ac944f -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 212
5 UIKit 0x008de10d -[UIViewController presentModalViewController:withTransition:] + 2937
6 Marrily 0x00137079 -[TiApp attachModal:toController:animated:] + 290
7 Marrily 0x001370a8 -[TiApp attachModal:toController:animated:] + 337
8 Marrily 0x00135b13 -[TiApp showModalController:animated:] + 231
9 Marrily 0x0005386c -[TiWindowProxy open:] + 2436
10 Foundation 0x005af3ca
NSThreadPerformPerform + 251
11 CoreFoundation 0x037e8faf CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 15
12 CoreFoundation 0x0374739b CFRunLoopDoSources0 + 571
13 CoreFoundation 0x03746896
CFRunLoopRun + 470
14 CoreFoundation 0x03746350 CFRunLoopRunSpecific + 208
15 CoreFoundation 0x03746271 CFRunLoopRunInMode + 97
16 GraphicsServices 0x053ee00c GSEventRunModal + 217
17 GraphicsServices 0x053ee0d1 GSEventRun + 115
18 UIKit 0x0083eaf2 UIApplicationMain + 1160
19 Marrily 0x00003b49 main + 362
20 Marrily 0x00002931 start + 53
21 ??? 0x00000001 0x0 + 1
2010-10-05 17:01:21.461 Marrily[8996:207]
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempting to begin a modal transition from <TiErrorController: 0x7ee6590> to <UINavigationController: 0x7ef0df0> while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed'
*** Call stack at first throw: ( 0 CoreFoundation 0x03807b99 exceptionPreprocess + 185
1 libobjc.A.dylib 0x0395740e objc_exception_throw + 47
2 CoreFoundation 0x037c0238 +[NSException raise:format:arguments:] + 136
3 Foundation 0x0062ae37 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
4 UIKit 0x00ac944f -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 212
5 UIKit 0x008de10d -[UIViewController presentModalViewController:withTransition:] + 2937
6 Marrily 0x00137079 -[TiApp attachModal:toController:animated:] + 290
7 Marrily 0x001370a8 -[TiApp attachModal:toController:animated:] + 337
8 Marrily 0x00135b13 -[TiApp showModalController:animated:] + 231
9 Marrily 0x0005386c -[TiWindowProxy open:] + 2436
10 Foundation 0x005af3ca
NSThreadPerformPerform + 251
11 CoreFoundation 0x037e8faf CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 15
12 CoreFoundation 0x0374739b CFRunLoopDoSources0 + 571
13 CoreFoundation 0x03746896
CFRunLoopRun + 470
14 CoreFoundation 0x03746350 CFRunLoopRunSpecific + 208
15 CoreFoundation 0x03746271 CFRunLoopRunInMode + 97
16 GraphicsServices 0x053ee00c GSEventRunModal + 217
17 GraphicsServices 0x053ee0d1 GSEventRun + 115
18 UIKit 0x0083eaf2 UIApplicationMain + 1160
19 Marrily 0x00003b49 main + 362
20 Marrily 0x00002931 start + 53
21 ??? 0x00000001 0x0 + 1
) terminate called after throwing an instance of 'NSException'

Comments

  1. Stephen Tramer 2011-04-15

    Still valid. Test checked into bugtests.

  2. Stephen Tramer 2011-04-15

    Forgot, this is a high priority as it's a BAD crasher.

  3. Jacob Relkin 2011-04-21

    This is a bug that runs quite deep. What to do when JSLint throws errors is yet to be determined. Putting on hold and assigning to Reggie.
  4. Eric Merriman 2011-05-11

    Per the last comment, this is on hold and not fixed yet. Setting to Unresolved.
  5. Thomas Huelbert 2011-05-25

    ipad1 4.3 Titanium SDK version: 1.7.0 (05/24/11 22:37 294b6aa...)

JSON Source