Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19614] Setting showUndoRedoActions to true after creation crashes app

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2015-09-30T19:48:40.000+0000
Affected Version/sRelease 5.0.0
Fix Version/sRelease 5.1.0
ComponentsiOS
Labelsn/a
ReporterFokke Zandbergen
AssigneeHans Knöchel
Created2015-09-29T12:27:17.000+0000
Updated2015-10-14T17:55:52.000+0000

Description

The example code in TIMOB-19150 shows that an app crashes when you set showUndoRedoActions to true after creation. This is an example covering both Ti.UI.TextField and Ti.UI.TextArea:

var showUndoRedoActionsField = true
var showUndoRedoActionsArea = true

var win = Ti.UI.createWindow({backgroundColor: "#fff",layout: "vertical"});
var field = Ti.UI.createTextArea({width: 300,height: 50,top: 100,backgroundColor: "#f0f0f0"});
var area = Ti.UI.createTextArea({width: 300,height: 300,top: 100,backgroundColor: "#f0f0f0"});
var btn1 = Ti.UI.createButton({title: "Toggle field"});
var btn2 = Ti.UI.createButton({title: "Toggle area"});

field.showUndoRedoActions = showUndoRedoActionsField;
area.showUndoRedoActions = showUndoRedoActionsArea;

btn1.addEventListener("click", function() {
    showUndoRedoActionsField = !showUndoRedoActionsField;
    field.showUndoRedoActions = showUndoRedoActionsField;
});
btn2.addEventListener("click", function() {
    showUndoRedoActionsArea = !showUndoRedoActionsArea;
    area.showUndoRedoActions = showUndoRedoActionsArea;
});

win.add(field);
win.add(btn1);
win.add(area);
win.add(btn2);
win.open();

Tap the button twice (first sets it to false) and the app will crash with:
[ERROR] 2015-09-29 14:21:19.883 theme[21620:3697521] -[CALayer copyWithZone:]: unrecognized selector sent to instance 0x7fc528d3c790
[ERROR] Script Error {
[ERROR]     column = 10;
[ERROR]     line = 12;
[ERROR]     message = "-[CALayer copyWithZone:]: unrecognized selector sent to instance 0x7fc528d3c790";
[ERROR]     sourceURL = "file:///Users/fokkezb/Library/Developer/CoreSimulator/Devices/C19B50F8-3D4C-4516-BFCB-4E7A1BA8D982/data/Containers/Bundle/Application/BD0C4CF3-5C08-44D3-8A66-8BD3C6B8B4E1/theme.app/app.js";
[ERROR]     stack = "file:///Users/fokkezb/Library/Developer/CoreSimulator/Devices/C19B50F8-3D4C-4516-BFCB-4E7A1BA8D982/data/Containers/Bundle/Application/BD0C4CF3-5C08-44D3-8A66-8BD3C6B8B4E1/theme.app/app.js:12:10";
[ERROR] }

Comments

  1. Hans Knöchel 2015-09-29

    PR pending (fixing both TextArea and TextField): https://github.com/appcelerator/titanium_mobile/pull/7243 [~apetkov] Can you do a functional test?
  2. Eric Wieber 2015-10-14

    Verified fixed, using: MacOS 10.11 (15A284) Studio 4.4.0.201510092420 Ti SDK 5.1.0.v20151013151603 Appc NPM 4.2.1-1 Appc CLI 5.1.0-38 Ti CLI 5.0.5 Alloy 1.7.16 Arrow 1.3.13 Xcode 7.0.1 (7A1001) Node v4.1.0 Java 1.7.0_80 production Toggling the undo/redo actions or the entire actions bar after creation does not crash the app.

JSON Source