mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-01 15:38:29 +00:00
Only save ibus_addr_file after we've successfully read an address from it.
Fixes https://github.com/libsdl-org/SDL/issues/3359
(cherry picked from commit bc3d9e99f3
)
This commit is contained in:
@@ -574,15 +574,17 @@ SDL_bool SDL_IBus_Init(void)
|
|||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* !!! FIXME: if ibus_addr_file != NULL, this will overwrite it and leak (twice!) */
|
|
||||||
ibus_addr_file = SDL_strdup(addr_file);
|
|
||||||
|
|
||||||
addr = IBus_ReadAddressFromFile(addr_file);
|
addr = IBus_ReadAddressFromFile(addr_file);
|
||||||
if (addr == NULL) {
|
if (addr == NULL) {
|
||||||
SDL_free(addr_file);
|
SDL_free(addr_file);
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ibus_addr_file) {
|
||||||
|
SDL_free(ibus_addr_file);
|
||||||
|
}
|
||||||
|
ibus_addr_file = SDL_strdup(addr_file);
|
||||||
|
|
||||||
if (inotify_fd < 0) {
|
if (inotify_fd < 0) {
|
||||||
inotify_fd = inotify_init();
|
inotify_fd = inotify_init();
|
||||||
fcntl(inotify_fd, F_SETFL, O_NONBLOCK);
|
fcntl(inotify_fd, F_SETFL, O_NONBLOCK);
|
||||||
|
Reference in New Issue
Block a user