summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-10 11:10:41 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-10 11:10:41 +0200
commit1c72027ba0880c30e9d8d382869798136c493f76 (patch)
tree508d0d44ca81313f48ffcbc0dcc43d87ca6bf12f /src/app.c
parentbc4bf2c73c29cd27ce4516a57691e9b44e66b15f (diff)
App: Events posted early may cause a crash
Attempting to ask SDL about a non-existent window's ID.
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/app.c b/src/app.c
index e9a2c638..90ad271d 100644
--- a/src/app.c
+++ b/src/app.c
@@ -702,7 +702,7 @@ static int resizeWatcher_(void *user, SDL_Event *event) {
702 SDL_Event u = { .type = SDL_USEREVENT }; 702 SDL_Event u = { .type = SDL_USEREVENT };
703 u.user.code = command_UserEventCode; 703 u.user.code = command_UserEventCode;
704 u.user.data1 = strdup("theme.changed"); 704 u.user.data1 = strdup("theme.changed");
705 u.user.windowID = SDL_GetWindowID(d->window->win); 705 u.user.windowID = id_Window(d->window);
706 dispatchEvent_Widget(d->window->root, &u); 706 dispatchEvent_Widget(d->window->root, &u);
707 } 707 }
708#endif 708#endif
@@ -795,7 +795,7 @@ void postRefresh_App(void) {
795 SDL_Event ev; 795 SDL_Event ev;
796 ev.user.type = SDL_USEREVENT; 796 ev.user.type = SDL_USEREVENT;
797 ev.user.code = refresh_UserEventCode; 797 ev.user.code = refresh_UserEventCode;
798 ev.user.windowID = get_Window() ? SDL_GetWindowID(get_Window()->win) : 0; 798 ev.user.windowID = id_Window(get_Window());
799 ev.user.data1 = NULL; 799 ev.user.data1 = NULL;
800 ev.user.data2 = NULL; 800 ev.user.data2 = NULL;
801 SDL_PushEvent(&ev); 801 SDL_PushEvent(&ev);
@@ -820,7 +820,7 @@ void postCommand_App(const char *command) {
820 } 820 }
821 ev.user.type = SDL_USEREVENT; 821 ev.user.type = SDL_USEREVENT;
822 ev.user.code = command_UserEventCode; 822 ev.user.code = command_UserEventCode;
823 ev.user.windowID = get_Window() ? SDL_GetWindowID(get_Window()->win) : 0; 823 ev.user.windowID = id_Window(get_Window());
824 ev.user.data1 = strdup(command); 824 ev.user.data1 = strdup(command);
825 ev.user.data2 = NULL; 825 ev.user.data2 = NULL;
826 SDL_PushEvent(&ev); 826 SDL_PushEvent(&ev);