Acknowledged

CIQ app crashes on Instinct 2 when resource is used in ActionMenuItem

Hi, I have found interesting CIQ crash with instinct 2. The following code results in app crash, when I try to create instance of MainMenu class

import Toybox.WatchUi;

class MainMenu extends WatchUi.ActionMenu {
function initialize() {
ActionMenu.initialize({:theme=>WatchUi.ACTION_MENU_THEME_DARK});
addItem(new WatchUi.ActionMenuItem({:label=>Rez.Strings.test}, :next));
}
}

with following message in log

Error: Unhandled Exception
Time: 2023-03-04T21:20:01Z
Part-Number: 006-B3888-00
Firmware-Version: '11.18'
Language-Code: ces
ConnectIQ-Version: 4.2.1
Filename: test
Appname: test
Stack:
  - pc: 0x30005910
  - pc: 0x1000019f
    File: /home/jirka/Dev/test/source/mainMenu.mc
    Line: 6
    Function: initialize
  - pc: 0x10000111
    File: /home/jirka/Dev/test/source/testApp.mc
    Line: 9
    Function: initialize

When I load the string from resource first and the I use it, everything works ok

import Toybox.WatchUi;

class MainMenu extends WatchUi.ActionMenu {
function initialize() {
var tmp = WatchUi.loadResource(Rez.Strings.test);
ActionMenu.initialize({:theme=>WatchUi.ACTION_MENU_THEME_DARK});
addItem(new WatchUi.ActionMenuItem({:label=>tmp}, :next));
}
}

This happens only on real Instinct 2, everything works ok in simulator. The main problem is, that this crash prevents me from using action-menu in resources as it generates code, that leads to crash. Is this bug in FW or am I doing something the wrong way?

Parents Comment Children
No Data