diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-10 10:01:05 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-10 10:01:05 +0200 |
commit | e60ddfc9afc26b75cf9aa31c1a8c3b7e390a4ac7 (patch) | |
tree | f393292fe7c4728f502c459cbc77775cd3f80b93 /src/ui | |
parent | 41571b424d9358f01b0e9f00b2906e3640cf5814 (diff) |
Widget: Crash if moving widget is deleted
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/widget.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index ec229b86..b31b3c08 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -91,6 +91,17 @@ void init_Widget(iWidget *d) { | |||
91 | iZap(d->padding); | 91 | iZap(d->padding); |
92 | } | 92 | } |
93 | 93 | ||
94 | static void visualOffsetAnimation_Widget_(void *ptr) { | ||
95 | iWidget *d = ptr; | ||
96 | postRefresh_App(); | ||
97 | if (!isFinished_Anim(&d->visualOffset)) { | ||
98 | addTicker_App(visualOffsetAnimation_Widget_, ptr); | ||
99 | } | ||
100 | else { | ||
101 | setFlags_Widget(d, visualOffset_WidgetFlag, iFalse); | ||
102 | } | ||
103 | } | ||
104 | |||
94 | void deinit_Widget(iWidget *d) { | 105 | void deinit_Widget(iWidget *d) { |
95 | releaseChildren_Widget(d); | 106 | releaseChildren_Widget(d); |
96 | #if !defined (NDEBUG) | 107 | #if !defined (NDEBUG) |
@@ -101,6 +112,9 @@ void deinit_Widget(iWidget *d) { | |||
101 | if (d->flags & keepOnTop_WidgetFlag) { | 112 | if (d->flags & keepOnTop_WidgetFlag) { |
102 | removeAll_PtrArray(onTop_RootData_(), d); | 113 | removeAll_PtrArray(onTop_RootData_(), d); |
103 | } | 114 | } |
115 | if (d->flags & visualOffset_WidgetFlag) { | ||
116 | removeTicker_App(visualOffsetAnimation_Widget_, d); | ||
117 | } | ||
104 | widgetDestroyed_Touch(d); | 118 | widgetDestroyed_Touch(d); |
105 | } | 119 | } |
106 | 120 | ||
@@ -191,17 +205,6 @@ void setPadding_Widget(iWidget *d, int left, int top, int right, int bottom) { | |||
191 | d->padding[3] = bottom; | 205 | d->padding[3] = bottom; |
192 | } | 206 | } |
193 | 207 | ||
194 | static void visualOffsetAnimation_Widget_(void *ptr) { | ||
195 | iWidget *d = ptr; | ||
196 | postRefresh_App(); | ||
197 | if (!isFinished_Anim(&d->visualOffset)) { | ||
198 | addTicker_App(visualOffsetAnimation_Widget_, ptr); | ||
199 | } | ||
200 | else { | ||
201 | setFlags_Widget(d, visualOffset_WidgetFlag, iFalse); | ||
202 | } | ||
203 | } | ||
204 | |||
205 | void setVisualOffset_Widget(iWidget *d, int value, uint32_t span, int animFlags) { | 208 | void setVisualOffset_Widget(iWidget *d, int value, uint32_t span, int animFlags) { |
206 | setFlags_Widget(d, visualOffset_WidgetFlag, iTrue); | 209 | setFlags_Widget(d, visualOffset_WidgetFlag, iTrue); |
207 | if (span == 0) { | 210 | if (span == 0) { |