Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19137] Windows: Showing an alert dialog when another alert dialog is on screen throws runtime error

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2015-07-09T20:17:31.000+0000
Affected Version/sRelease 4.1.0
Fix Version/sRelease 5.0.0
ComponentsWindows
Labelsqe-4.1.0
ReporterEwan Harris
AssigneeGary Mathews
Created2015-07-02T01:04:38.000+0000
Updated2015-07-15T02:10:05.000+0000

Description

Description

When showing an alert dialog if one is already shown then the app will throw a runtime error.
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
    backgroundColor:'#fff'
});

var label1 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 1',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});

label1.addEventListener('click', function(){
	alert('hi');
	setTimeout(function(){
		alert('hi2');
	},1000);
})

win1.add(label1);

win1.open();

Steps to reproduce

1. Add the above code to an app.js 2. Build to an emulator/device 3. Tap the label 4. Dismiss the alert and the runtime error 5. Tap the label and then tap the close button

Actual result

3. The app will throw a runtime error 5. No runtime error as the first alert has been dismissed

Expected result

A runtime error should not be thrown

Comments

  1. Christopher Williams 2015-07-07

    For comparison: on iOS, when I tried this, the first alert dialog remained open until I dismissed it, then the second one appeared. So it basically waited until the first was done. Looks like we need to implement some queue or locking mechanism for subsequent dialogs to wait until the first is dismissed. Here's the relevant code in iOS: https://github.com/appcelerator/titanium_mobile/blob/17dc8754653daaff170ea0c18f74218168a5633e/iphone/Classes/TiUIAlertDialogProxy.m#L90
  2. Gary Mathews 2015-07-09

    PR: https://github.com/appcelerator/titanium_mobile_windows/pull/367
  3. Lokesh Choudhary 2015-07-10

    Verified the fix. Showing an alert dialog with another dialog now does not throw any runtime error. Closing. Environment: Appc Studio: 4.1.0.201507071122 Ti SDK: 4.2.0.v20150710092422 Ti CLI: 4.0.1 Alloy: 1.6.2 Windows: 8.1 Enterprise 64-bit APPC NPM: 4.1.0 APPC CLI: 4.1.0 Device: Nokia Lumia 928 - Windows Phone 8.1 Windows emulator : 8.1

JSON Source