Skip to content

Commit f92f990

Browse files
committed
Fix crash
1 parent c07fbf6 commit f92f990

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/displayapp/widgets/PopupMessage.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,20 @@ void PopupMessage::Create() {
1717
lv_obj_set_style_local_bg_opa(btnPopup, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_60);
1818
lv_obj_t* lblMessage = lv_label_create(btnPopup, nullptr);
1919
lv_label_set_text_static(lblMessage, message);
20-
lv_obj_set_hidden(btnPopup, true);
20+
lv_obj_set_hidden(btnPopup, isHidden);
2121
}
2222

2323
void PopupMessage::SetHidden(bool hidden) {
24-
NRF_LOG_INFO("PopupMessage::SetHidden - hidden %d, ptr: %p", hidden, btnPopup);
2524
if (isHidden == hidden) {
2625
return;
2726
}
2827
isHidden = hidden;
28+
// create/delete on demand
2929
if (btnPopup == nullptr && !isHidden) {
3030
Create();
3131
} else if (btnPopup != nullptr) {
32-
lv_obj_set_hidden(btnPopup, isHidden);
32+
lv_obj_del (btnPopup);
33+
btnPopup = nullptr;
3334
}
3435
}
3536

0 commit comments

Comments
 (0)