SDL crashes when accessing IBUS (with workaround)

Hi there,

when I start 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/
#2  0xb79bf7e8 in abort () from /lib/
#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/
#8  0xb7efcc64 in SDL_DBus_CallVoidMethodOnConnection () from /usr/lib/
#9  0xb7efdeb5 in IBus_SimpleMessage () from /usr/lib/
#10 0xb7efda6b in IBus_SetupConnection () from /usr/lib/
#11 0xb7efdbd9 in SDL_IBus_Init () from /usr/lib/
#12 0xb7efcffe in SDL_IME_Init () from /usr/lib/
#13 0xb7ee7b75 in X11_InitKeyboard () from /usr/lib/
#14 0xb7eeec34 in X11_VideoInit () from /usr/lib/
#15 0xb7ed45d6 in SDL_VideoInit_REAL () from /usr/lib/
#16 0xb7e42be2 in SDL_InitSubSystem_REAL () from /usr/lib/
#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 ()

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:

As far as I can tell, SDL_IBus_Init isn’t supposed to be accessed by normal means since it is a wrapper around either the IBus or Fcitx library. When is your crash happening, (while using SDL_Init, or something else)? Are you using a pre-compiled version of SDL2, or are you compiling it yourself?

Im using following precompiled version (openSUSE_Tumbleweed i586):

My package manager shows version string “2.0.8-88.1”

I just tried it out: same is happening with “2.0.8-3.1”

I cann’t tell you more than the backtrace. As far as I see from the source SDL_Init and SDL_InitSubSystem are distinct, so answer to your question: NO. SDL_InitSubSystem_REAL comes from SDL_InitSubSystem after SDL_DYNAPI_PROC macro, I guess.


Honestly, I’m beginning to think that you may need to compile the library yourself to get rid of IBus. Do you need International input support in the game?