ibusManager, inputMethod: Cancel ibus calls chain on disconnection
The shell tries to spawn the ibus daemon on startup if unavailable, however as per commit 8adfc5b1 we also force restarting it once the X11 server is available. Unfortunately this could cause a race if we disconnect while we were already connected to an ibus daemon, but still in the process of going through the various nested calls. In fact the ::disconnect callback didn't stop any further async ibus call that, even if failing, would have eventually triggered the emission of a 'ready' signal and to the Keyboard's callback, leading under X11 to a full grab owned by ibus daemon.
In order to avoid this and keep control of the calls order, use in both IbusManager and InputMethod a cancellable that is setup before connecting to the bus, and that is cancelled on disconnection. Then handle the finish() calls properly, using try/catch to validate the returned value, taking in account the potential error and just not proceeding in case of cancellation.
Fixes #1712 (closed)