From cfcef655e6d85f683e6a113c010f77cd15313bc0 Mon Sep 17 00:00:00 2001 From: MysterD Date: Sun, 7 Aug 2022 22:36:35 -0700 Subject: [PATCH] Fix crash when hitting escape while a slider is focused --- src/pc/djui/djui_base.c | 5 +++++ src/pc/djui/djui_slider.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/pc/djui/djui_base.c b/src/pc/djui/djui_base.c index d86cd788..4c80de58 100644 --- a/src/pc/djui/djui_base.c +++ b/src/pc/djui/djui_base.c @@ -329,6 +329,11 @@ void djui_base_destroy(struct DjuiBase* base) { gDjuiHovered = NULL; } + // remove focus + if (gInteractableFocus == base) { + gInteractableFocus = NULL; + } + // remove binding if (gInteractableBinding == base) { gInteractableBinding = NULL; diff --git a/src/pc/djui/djui_slider.c b/src/pc/djui/djui_slider.c index d9b8a653..008b8000 100644 --- a/src/pc/djui/djui_slider.c +++ b/src/pc/djui/djui_slider.c @@ -136,5 +136,7 @@ struct DjuiSlider* djui_slider_create(struct DjuiBase* parent, const char* messa base->get_cursor_hover_location = djui_slider_get_cursor_hover_location; + slider->base.interactable->update_style = NULL; + return slider; }