Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6654] iOS: Picker Column with mixed row types crashes app

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionCannot Reproduce
Resolution Date2012-09-12T11:18:33.000+0000
Affected Version/sRelease 1.7.5, Release 1.8.0.1
Fix Version/sSprint 2012-19 API
ComponentsiOS
Labelsapi
ReporterAlan Leard
AssigneeVishal Duggal
Created2011-12-13T18:31:05.000+0000
Updated2013-03-13T15:03:39.000+0000

Description

Issue

If you have a Picker Column with a basic picker row added with just a title, and then have another row added with an object (label or Image) added to the row, the app will eventually crash after several picker row changes.

Code Sample

var win = Ti.UI.createWindow();

var picker = Ti.UI.createPicker({
		top: 50,
		left: 0,
		right: 0,
		selectionIndicator: true
	});

	win.add(picker);

	var oCountryRows = [];

	var colCountries = Ti.UI.createPickerColumn({
		width: 100
});
//////WILL CRASH APP/////////////
	var rowAny = Ti.UI.createPickerRow({
		fontSize: 12,
		font: {fontSize:12},
		id: 0,
		title: 'Any'
	});
///////////////////////////////////	

//////WORKS FINE///////////////////
	// var rowAny = Ti.UI.createPickerRow();
	// var coAnyLabel = Ti.UI.createLabel({
		// text:'Any',
		// color:'#000',
		// textAlign:'center',
		// font:{fontWeight:'bold', fontSize:12}
	// });
	// rowAny.add(coAnyLabel);
//////////////////////////////////////
	colCountries.addRow(rowAny);
	oDataCountry = [
		{id:0,name:'England'}, 
		{id:1,name:'France'},
		{id:2,name:'Scotland'},
		{id:3,name:'South-Africa'},
		{id:4,name:'Turkey'},
		{id:5,name:'Wales'}
	];
	for(var i=0;i<oDataCountry.length;i++) {
		var row = Ti.UI.createPickerRow({
			id:oDataCountry[i].id
		});
		var txt = Ti.UI.createLabel({height:30, width:80,text:oDataCountry[i].name, color:'#000'});

		row.add(txt);

		colCountries.addRow(row);
	}

	picker.add([colCountries]);

win.open();

Repro Steps

1.Drop code into app.js and run app 2.Scroll up and down through all the rows 2-3 times 3.App will freeze and crash 4.Comment out lines 18-23 and uncomment lines 27-34 and run app 5.Scroll up and down as much as you want, the app will not crash

Crash Log

See attached file for Crash Log

Attachments

FileDateSize
crashLog.rtf2011-12-13T18:31:05.000+000038497

Comments

  1. Vishal Duggal 2012-09-12

    Tested on latest master with iPhone and iPad Sim (4.3, 5.0, 5.1) and iPhone 4(5.1.1). Could not reproduce. Probably fixed by the fix for TIMOB-6913
  2. Satyam Sekhri 2012-10-25

    Cannot Reproduce. Verified On: Titanium Studio: 3.0.0.201210220122 Titanium SDK: 3.0.0.v20121019153308 iOS Simulator 4.3, 5.1

JSON Source