Skip to content

inputMethod: Compare ibus context before processing key event result

Carlos Garnacho requested to merge wip/carlosg/ibus-assert into master

In the xwayland-on-demand scenario, it may happen that Xwayland is shutdown (causing a restart of ibus-daemon to drop ibus-x11) while we are typing.

If we have a bit of bad luck, this will cause the IBusInputContext to be disposed (due to its bus "closing") at a time when we have an ibus_input_context_process_key_event_async() request on the fly.

As the object is disposed in between this would tickle JS (rightfully complaining that it's been disposed under its feet) and make us pass an actually NULL IBusInputContext to the corresponding _finish() function (despite the IBusInputContext being still held alive by some other refs). This will assert and abort in ibus_input_context_process_key_event_async_finish() then.

To handle this, listen for IBusInputContext::destroy, and reset our internal state, this way we can compare on the JS side that the IBusInputContext is indeed an up-to-date one.

Merge request reports