Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2143] iOS Crash: infinite loop on createButton top with non-integer value

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:58:13.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0
ComponentsiOS
Labelscrash, createbutton, defect, infinite, ios, loop, math.floor
ReporterThomas Huelbert
AssigneeBlain Hamon
Created2011-04-15T03:11:45.000+0000
Updated2011-04-17T01:58:13.000+0000

Description

(bug from David Richey, logged by Thomas Huelbert pending creating of account for David.)

Environment
OS 10.6.4, XCode 4.0, iPhone emulator 4.0 SDK, Titanium Desktop 1.2.1, Titanium Mobile 1.4

Steps to reproduce

The following code works:

var pass = Titanium.UI.createButton({

    backgroundImage: 'add3_button_pass.png',
    title: 'New',
    font: {fontWeight:'bold'},
    color: '#white',
    top:    Math.floor(goalBanner.height * 0.15),
    height: Math.floor(goalBanner.height * 0.68),
    left:   Math.floor(platformWidth * 0.86),
    width:  Math.floor(platformWidth * 0.13),
    zIndex: 10

});

You can make it fail by removing the Math.floor(...) from the top: property, thus:

var pass = Titanium.UI.createButton({

    backgroundImage: 'add3_button_pass.png',
    title: 'New',
    font: {fontWeight:'bold'},
    color: '#white',
    top:    (goalBanner.height * 0.15),
    height: Math.floor(goalBanner.height * 0.68),
    left:   Math.floor(platformWidth * 0.86),
    width:  Math.floor(platformWidth * 0.13),
    zIndex: 10

});

Failure mode:
On Launch from Titanium Developer, app loads and then immediately crashes. ("Application exited from Simulator")

Crash log:

Attachments

FileDateSize
testb_2010-10-21-104137_mpb15.crash2011-04-15T03:11:45.000+000081085

Comments

  1. Thomas Huelbert 2011-04-15

    This bug is blocking the release of the Math Puzzle sample app.

  2. Blain Hamon 2011-04-15

    Way back in http://github.com/appcelerator/titanium_mobile/commit/3b55284ca46dd07e37dd378cabc21150afcb843a#diff-3"> http://github.com/appcelerator/titanium_mobile/commit/3b55284ca46dd... , we made set the frame to be integral. This is what's causing the infinite loop. Is this still valid or should we remove the descendant of this code?

    More importantly, the reason we did this was to make everything line up. But there may be times when this is not desired, or that lining things up causes ugly gaps.

  3. Jeff Haynie 2011-04-15

    (from [08dbb2ffc8b541d0d2e15f30aa20ec0018791f0a]) [#1984 state:fixed-in-qa] [#2143 state:fixed-in-qa] [#1838 state:fixed-in-qa] We no longer try to enforce buttons onto integer boundaries http://github.com/appcelerator/titanium_mobile/commit/08dbb2ffc8b541d0d2e15f30aa20ec0018791f0a"> http://github.com/appcelerator/titanium_mobile/commit/08dbb2ffc8b54...

  4. Stephen Tramer 2011-04-15

    iPod 3GT 4.2.1, 1.5.0.a899d42

JSON Source