Entire watch crashes after experimenting with custom fonts

Hi,

I introduced a new setting which let the user decide whether to use the system font or another one. After I set "the other one" in the settings, the entire watch crashes. The only way to get the watch running again was to connect it to the PC and delete manually the prg file.

Here is what I did:

https://www.dropbox.com/s/yestbbaqvg12hai/Hang.JPG?dl=0

If I leave the setting to system font the watch works well, but as soon as I use the customFont the entire watch hangs, shows a big triangle and just beeps on each key press. Any ideas what's going on?
  • I removed now the doubled declaration of customFont in the onLayout() method and voila, the watch doesn't crashes any more. Thanks for giving me all those hints.

    PUFFOLINO: I tried you Sys.println but the simulator did hang up as soon as I print out fontHours (but only if customFont is selected, if Gfx.FONT_NUMBER_THAI_HOT is selected, the console says "8").
  • I'm still a little bit nervous why the print should force the simulator to crash... maybe a memory leak when doing multiple loads?
    ...I would like to have a look into the code (even a reduced version of it) to see what happens - if you don't mind you can send me a PM.
  • I removed now the doubled declaration of customFont in the onLayout() method and voila

    You had two declarations for customFont? If this is the case, it is possible that one of them was getting initialized and the other one was not (I'd want to see all of the code to see what was really going on).

    That said, no ConnectIQ app should be able to cause the device to crash or hang. I think it is very important that someone be able to reproduce the problem and file a bug so that the issue is looked at by the Garmin team. Nobody wants stuff like this to get into the wild and crash user devices.

    Travis

  • Travis and Puffolino, I will stick a coding version together and will provide it via pm to you as soon as I will find some time. Pasting code here in the forums doesn't work anyway currently...
  • The simulator may crash very easily (never uploaded such a prg to my watch)...

    using Toybox.Application as App;
    using Toybox.Graphics as Gfx;
    using Toybox.WatchUi as Ui;
    using Toybox.Position as Pos;
    using Toybox.System as Sys;


    class MyView extends Ui.View
    {
    var crasher;
    var timer=new Timer.Timer<>;

    function initialize<>
    {
    View.initialize<>;

    crasher=0;
    Sys.println<crasher>;

    timer.start<method<:callback>,500,true>;
    }


    function callback<>
    {
    crasher+=1;
    Ui.requestUpdate<>;
    }

    function onUpdate<dc>
    {
    dc.setColor<Gfx.COLOR_WHITE, Gfx.COLOR_BLACK>;
    dc.clear<>;
    dc.drawText<120,80,Gfx.FONT_SMALL,"#"+crasher,Gfx.TEXT_JUSTIFY_CENTER>;
    dc.drawText<120,120,crasher,"ok",Gfx.TEXT_JUSTIFY_CENTER>;

    if <crasher == 9>
    {
    //dc.drawText<120,120,*,"not ok",Gfx.TEXT_JUSTIFY_CENTER>;
    //dc.drawText<120,120,timer,"not ok",Gfx.TEXT_JUSTIFY_CENTER>;
    }

    }


    }

    class MyBehaviour extends Ui.BehaviorDelegate
    {
    function initialize<> { Ui.BehaviorDelegate.initialize<>; }
    function onMenu<> { return true; }
    function onSelect<> { Ui.requestUpdate<>; return true; }
    }

    class Test extends App.AppBase
    {
    function initialize<> { AppBase.initialize<>; }
    function getInitialView<> { return [new MyView<>, new MyBehaviour<>]; }
    }




    replace <> by paren and * by [0]