ui/lvgl: fix a bug where a top container didn't have its object created
ci/woodpecker/push/woodpecker Pipeline was successful Details

a previous commit 7d1ab5cb rewrote toplayer objects creation as
Container.newTop except the new code was using the top layer object
obtained from lv_disp_get_layer_top as is. this obviously led to all
sorts of UB and illegal memory access when screen.sleep'ing.
pull/24/head
alex 1 year ago
parent 7d1ab5cb78
commit c1a809c567
Signed by: x1ddos
GPG Key ID: FDEFB4A63CBD8460

@ -482,7 +482,8 @@ pub const Container = struct {
/// suitable for widgets like a popup window.
pub fn newTop() !Container {
const toplayer = lv_disp_get_layer_top(null);
return .{ .lvobj = toplayer };
const o = lv_obj_create(toplayer) orelse return error.OutOfMemory;
return .{ .lvobj = o };
}
/// applies flex layout to the container.