Sorry, I completely missed the undo button. My brain isn’t 100% today…
I spent some time trying to reproduce this on the simulator and I’ve seen it both work and crash. Needless to say, I am confused as to what’s going on as I never see a crash in my embedded app.
Anyway, here’s my code. Am I missing anything obvious that you can see when switching screens and using a different image? In my embedded app it doesn’t matter which file comes first or second, and the first will always display while the second is garbled.
static void cb_btn(lv_obj_t *obj, lv_event_t event);
static void second_screen();
static lv_style_t mystyle;
const lv_color_t MY_GRAY = {{5, 9, 5}}; // b, g, r
// Called from main() prior to the task loop
void menu_create(void)
{
png_decoder_init();
lv_style_copy(&mystyle, &lv_style_plain);
mystyle.body.main_color = MY_GRAY;
mystyle.body.grad_color = MY_GRAY;
mystyle.body.border.width = 0;
mystyle.body.border.opa = LV_OPA_TRANSP;
mystyle.body.padding.left = 25;
mystyle.body.padding.right = 25;
lv_obj_t *cont = lv_cont_create(lv_scr_act(), NULL);
lv_obj_set_style(cont, &mystyle);
lv_obj_set_size(cont, 480, 272);
lv_cont_set_fit(cont, LV_FIT_NONE); // Container is static
lv_cont_set_layout(cont, LV_LAYOUT_COL_M);
lv_obj_t *logo = lv_img_create(cont, NULL);
lv_img_set_src(logo, "C:\\Projects\\test\\Strand_logo_220x82.png");
lv_obj_t *btn = lv_btn_create(cont, NULL);
lv_obj_set_event_cb(btn, cb_btn);
}
static void cb_btn(lv_obj_t *obj, lv_event_t event) {
switch(event) {
case LV_EVENT_CLICKED:
second_screen();
break;
};
}
static void second_screen() {
// Clean up all child-objs of the current screen
lv_obj_clean(lv_scr_act());
lv_obj_t *cont = lv_cont_create(lv_scr_act(), NULL);
lv_obj_set_style(cont, &mystyle);
lv_obj_set_size(cont, 480, 272); // 480x186 pixels
lv_cont_set_fit(cont, LV_FIT_NONE); // Container is static
lv_cont_set_layout(cont, LV_LAYOUT_COL_M);
lv_obj_t *logo = lv_img_create(cont, NULL);
lv_img_set_src(logo, "C:\\Projects\\test\\Strand_logo_300x112.png");
}
Screenshot from the simulator after pressing the button:

*edit* If I load the same image in both places I don’t have this issue at all. Not sure if that helps.