From 7d7110c1dfe376334317983b4c2734ddb474ac8c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi
Date: Sat, 18 Sep 2021 13:21:42 +0300
Subject: [PATCH 1/1] Fixed crash when hovered widget is destroyed
src/ui/root.c | 8 ++++++++
src/ui/widget.c | 7 +++++++
src/ui/window.c | 10 +++++-----
3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/src/ui/root.c b/src/ui/root.c
index 21bed366..b00fab28 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -278,6 +278,7 @@ void destroyPending_Root(iRoot *d) {
}
if (widget->flags & keepOnTop_WidgetFlag) {
removeOne_PtrArray(d->onTop, widget);
widget->flags &= ~keepOnTop_WidgetFlag;
}
iAssert(indexOf_PtrArray(d->onTop, widget) == iInvalidPos);
if (widget->parent) {
@@ -287,6 +288,13 @@ void destroyPending_Root(iRoot *d) {
iRelease(widget);
remove_PtrSetIterator(&i);
}
+#if 0
const iWidget *p = *t.value;
printf(" - %p {%s}\n", p, cstr_String(id_Widget(p)));
+#endif
setCurrent_Root(oldRoot);
}
diff --git a/src/ui/widget.c b/src/ui/widget.c
index 184ce2a3..95a39470 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -156,6 +156,13 @@ void deinit_Widget(iWidget *d) {
if (d->flags & visualOffset_WidgetFlag) {
removeTicker_App(visualOffsetAnimation_Widget_, d);
}
win->lastHover = NULL;
win->hover = NULL;
widgetDestroyed_Touch(d);
}
diff --git a/src/ui/window.c b/src/ui/window.c
index 0dd248e6..5ac4f95e 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1042,11 +1042,11 @@ void draw_Window(iWindow *d) {
when the custom frame is being used. */ {
setCurrent_Root(d->roots[0]);
#if defined (iPlatformMobile)
iColor back = get_Color(uiBackground_ColorId);
if (deviceType_App() == phone_AppDeviceType) {
/* Page background extends to safe area, so fill it completely. */
back = get_Color(tmBackground_ColorId);
}
iColor back = get_Color(uiBackground_ColorId);
if (deviceType_App() == phone_AppDeviceType) {
/* Page background extends to safe area, so fill it completely. */
back = get_Color(tmBackground_ColorId);
}
#else
const iColor back = get_Color(gotFocus && d->place.snap != maximized_WindowSnap &&
~winFlags & SDL_WINDOW_FULLSCREEN_DESKTOP
--
2.25.1
text/plain
This content has been proxied by September (3851b).