summaryrefslogtreecommitdiff
path: root/src/periodic.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-27 12:56:09 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-27 12:56:09 +0300
commit3846778c99d9efca609b7cb216cb71c675f036b0 (patch)
treecb126b07588036c24c5922c5c460d30be2204791 /src/periodic.c
parent9a7aa34e63132edb5906914ff99b861e64ee9099 (diff)
Keeping track of current UI root
The current UI root should always be set explicitly before the UI is accessed.
Diffstat (limited to 'src/periodic.c')
-rw-r--r--src/periodic.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/periodic.c b/src/periodic.c
index 9e9dfdba..ab3b66e6 100644
--- a/src/periodic.c
+++ b/src/periodic.c
@@ -22,6 +22,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23#include "periodic.h" 23#include "periodic.h"
24#include "ui/widget.h" 24#include "ui/widget.h"
25#include "ui/window.h"
25#include "app.h" 26#include "app.h"
26 27
27#include <the_Foundation/string.h> 28#include <the_Foundation/string.h>
@@ -64,6 +65,7 @@ iBool dispatchCommands_Periodic(iPeriodic *d) {
64 d->lastPostTime = now; 65 d->lastPostTime = now;
65 iBool wasPosted = iFalse; 66 iBool wasPosted = iFalse;
66 lock_Mutex(d->mutex); 67 lock_Mutex(d->mutex);
68 setCurrent_Root(&get_Window()->root);
67 iConstForEach(Array, i, &d->commands.values) { 69 iConstForEach(Array, i, &d->commands.values) {
68 const iPeriodicCommand *pc = i.value; 70 const iPeriodicCommand *pc = i.value;
69 const SDL_UserEvent ev = { 71 const SDL_UserEvent ev = {
@@ -75,6 +77,7 @@ iBool dispatchCommands_Periodic(iPeriodic *d) {
75 dispatchEvent_Widget(pc->context, (const SDL_Event *) &ev); 77 dispatchEvent_Widget(pc->context, (const SDL_Event *) &ev);
76 wasPosted = iTrue; 78 wasPosted = iTrue;
77 } 79 }
80 setCurrent_Root(NULL);
78 unlock_Mutex(d->mutex); 81 unlock_Mutex(d->mutex);
79 return wasPosted; 82 return wasPosted;
80} 83}