| Summary: | SDL crashes when accessing IBUS (with workaround) | ||
|---|---|---|---|
| Product: | SDL | Reporter: | post |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sezeroz, stsp2 |
| Version: | 2.0.8 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
Ryan, is this fixed with your recent change? I have the same problem.
The bug is that when "CreateInputContext" method
fails, SDL continues with IBus, hitting an assert.
Something like this should fix the problem (untested):
--- SDL_ibus.c.old 2018-11-04 01:12:50.074897655 +0300
+++ SDL_ibus.c 2018-11-04 01:14:58.376753098 +0300
@@ -342,6 +342,8 @@
dbus->connection_try_register_object_path(ibus_conn, input_ctx_path, &ibus_vtable, dbus, NULL);
dbus->connection_flush(ibus_conn);
result = SDL_TRUE;
+ } else {
+ return SDL_FALSE;
}
SDL_IBus_SetFocus(SDL_GetKeyboardFocus() != NULL);
(In reply to Stas Sergeev from comment #2) > I have the same problem. > The bug is that when "CreateInputContext" method > fails, SDL continues with IBus, hitting an assert. > Something like this should fix the problem (untested): > > --- SDL_ibus.c.old 2018-11-04 01:12:50.074897655 +0300 > +++ SDL_ibus.c 2018-11-04 01:14:58.376753098 +0300 > @@ -342,6 +342,8 @@ > dbus->connection_try_register_object_path(ibus_conn, input_ctx_path, &ibus_vtable, dbus, NULL); > dbus->connection_flush(ibus_conn); > result = SDL_TRUE; > + } else { > + return SDL_FALSE; > } > > SDL_IBus_SetFocus(SDL_GetKeyboardFocus() != NULL); Do we not need to do dbus->connection_close(ibus_conn) and dbus->connection_unref(ibus_conn) before returning SDL_FALSE in there? (In reply to Ozkan Sezer from comment #3) > Do we not need to do dbus->connection_close(ibus_conn) and > dbus->connection_unref(ibus_conn) before returning SDL_FALSE > in there? Likely so, ideed. For me the problem happens only on a multilib setup, the native one works properly. So I have not built the multilib version of SDL with the patch. It would be better if you attach the patch with your amendments, and hope someone will test. :) Well I only looked at the code briefly and made that comment: I do not have the issue myself so I cannot reproduce or test. (If only we had a foolproof reproducer for this.) (In reply to Ozkan Sezer from comment #5) > (If only we had a foolproof reproducer for this.) Easily: just modify the IBus_SetupConnection() the way to not call SDL_DBus_CallMethodOnConnection(), pretending it returned FALSE. Then you go further but with "input_ctx_path == NULL", which will quickly lead to an assert (right on SDL_IBus_SetFocus(), which is even called in the same function). |
When starting simutrans game I get an error from dbus which seems to complain about some ibus message. (I don’t know what ibus is for, but this isn’t important here). Error message and backtrace follow: dbus[8517]: arguments to dbus_message_new_method_call() were incorrect, assertion "path != NULL" failed in file dbus-message.c line 1362. This is normally a bug in some application using the D-Bus library. D-Bus not built with -rdynamic so unable to print a backtrace Program received signal SIGABRT, Aborted. 0xb7fd5d41 in __kernel_vsyscall () (gdb) bt #0 0xb7fd5d41 in __kernel_vsyscall () #1 0xb79d7132 in raise () from /lib/libc.so.6 #2 0xb79bf7e8 in abort () from /lib/libc.so.6 #3 0xb74ab34a in _dbus_abort () at dbus-sysdeps.c:93 #4 0xb74cf0ac in _dbus_warn_check_failed ( format=0xb74df6b8 "arguments to %s() were incorrect, assertion \"%s\" failed in file %s line %d.\nThis is normally a bug in some application using the D-Bus library.\n") at dbus-internals.c:281 #5 0xb74cf87b in _dbus_warn_return_if_fail (function=0xb74de5c0 <__func__.4821> "dbus_message_new_method_call", assertion=0xb74dab26 "path != NULL", file=0xb74ddbc1 "dbus-message.c", line=1362) at dbus-internals.c:936 #6 0xb74be1a7 in dbus_message_new_method_call (destination=0xb7f20bb4 <IBUS_SERVICE> "org.freedesktop.IBus", path=0x0, iface=0xb7f20b60 <IBUS_INPUT_INTERFACE> "org.freedesktop.IBus.InputContext", method=0xb7f20ac3 "FocusOut") at dbus-message.c:1367 #7 0xb7efc3f4 in SDL_DBus_CallVoidMethodInternal () from /usr/lib/libSDL2-2.0.so.0 #8 0xb7efcc64 in SDL_DBus_CallVoidMethodOnConnection () from /usr/lib/libSDL2-2.0.so.0 #9 0xb7efdeb5 in IBus_SimpleMessage () from /usr/lib/libSDL2-2.0.so.0 #10 0xb7efda6b in IBus_SetupConnection () from /usr/lib/libSDL2-2.0.so.0 #11 0xb7efdbd9 in SDL_IBus_Init () from /usr/lib/libSDL2-2.0.so.0 #12 0xb7efcffe in SDL_IME_Init () from /usr/lib/libSDL2-2.0.so.0 #13 0xb7ee7b75 in X11_InitKeyboard () from /usr/lib/libSDL2-2.0.so.0 #14 0xb7eeec34 in X11_VideoInit () from /usr/lib/libSDL2-2.0.so.0 #15 0xb7ed45d6 in SDL_VideoInit_REAL () from /usr/lib/libSDL2-2.0.so.0 #16 0xb7e42be2 in SDL_InitSubSystem_REAL () from /usr/lib/libSDL2-2.0.so.0 #17 0x0079cc9b in dr_os_init(int const*) () #18 0x00711e68 in simu_main(int, char**) () ---Type <return> to continue, or q <return> to quit--- #19 0x0072b07b in sysmain(int, char**) () #20 0x0041e127 in main () (gdb) So workaround is to start program with some misleading ibus setting, such as: IBUS_ADDRESS=bääää /usr/bin/simutrans This will let return SDL_IBus_Init with SDL_FALSE and game’s working. I suggest to either make SDL more robust against such errors or to publicly document IBUS_ADDRESS parameter (e.g. like this: https://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlenvvars.html). Remark: I posted this on mailing list and on https://discourse.libsdl.org/t/sdl-crashes-when-accessing-ibus-with-workaround/24713 but then discovered you wanted an entry in bugzilla. So this is kind-of duplicate.