InfiniTimeOrg / InfiniSim

Simulator for InfiniTime user interface without needing a PineTime
GNU General Public License v3.0
164 stars 66 forks source link

SegFault when alarm triggers while watch is asleep #8

Closed toastom closed 2 years ago

toastom commented 2 years ago

Thanks for making this awesome simulator for InfiniTime. I'm waiting for my PineTime to come in, so this is really handy to test the OS in the meantime.

I found a bug with the alarm capability. An alarm triggers fine when setting it an it goes off while the screen is awake. However, a segmentation fault occurs when the alarm triggers while the screen is asleep.

segfaultalarm

NeroBurner commented 2 years ago

Thank you for battle-testing the simulator. I can reproduce the segmentation fault on InfiniSim (fortunately not on InfiniTime-Firmware :relieved: )

work_mem_int (Unknown Source:0)
lv_event_send_func(lv_event_cb_t event_xcb, lv_obj_t * obj, lv_event_t event, const void * data) (/home/nero/repos/pinetime/InfiniSim/InfiniTime/src/libs/lvgl/src/lv_core/lv_obj.c:1968)
lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data) (/home/nero/repos/pinetime/InfiniSim/InfiniTime/src/libs/lvgl/src/lv_core/lv_obj.c:1880)
obj_del_core(lv_obj_t * obj) (/home/nero/repos/pinetime/InfiniSim/InfiniTime/src/libs/lvgl/src/lv_core/lv_obj.c:3760)
lv_obj_del(lv_obj_t * obj) (/home/nero/repos/pinetime/InfiniSim/InfiniTime/src/libs/lvgl/src/lv_core/lv_obj.c:485)
Framework::refresh_screen(Framework * const this) (/home/nero/repos/pinetime/InfiniSim/main.cpp:642)
Framework::refresh(Framework * const this) (/home/nero/repos/pinetime/InfiniSim/main.cpp:299)
main(int argc, char ** argv) (/home/nero/repos/pinetime/InfiniSim/main.cpp:733)

The segfaulting call is lv_obj_del(screen_off_bg); which tries to delete the "Screen is OFF" overlay https://github.com/InfiniTimeOrg/InfiniSim/blob/2b8b4edba3e1fe663d4208b278013fb68891d1fc/main.cpp#L642

      } else {
        if (screen_off_created) {
          screen_off_created = false;
          lv_obj_del(screen_off_bg);
          lv_obj_del(screen_off_label);
        }
      }

This doesn't happen on the countdown-timer, which also wakes up the watch successfully. Maybe the Alarm-App (or something while triggering the Alarm) clears the screen, which also removes the screen_off_bg lv_obj resulting in a double-free of said object

edit: need to switch away from Alarm Screen and dim to reproduce the segfault