Two races in text-test
Submitted by Daniel Stone
Assigned to Daniel Stone
text-test very very occasionally fails, which it turns out is down to two races, where we need to lose both.
Firstly, when text-test starts, it races desktop-shell startup. If desktop-shell wins the race, it will start weston-keyboard, which takes over as the input-manager backend. This means the zwp_text_input_manager_v1 bind will fail. You can provoke this every time by inserting a sleep above the registry walk. This alone is probably enough to cause a failure. This would be fixed by @sardemff7's dummy test-shell.
Secondly, there's another issue which looks like it might be relevant. I observed a crash once - and only once, despite hours of running it - in text-backend, which was a segfault inside text-backend, trying to send a modifiers_map event to a dead resource. The only way I could see that this would happen was if the text input was deactivated, but the context not. Here we clear out input_method->input and input_method->context, but //not// input_method->context->input. Just fixing this is definitely correct (and on the list), and goes with the
if (context->input) checks all through, but given the above, I don't think it's sufficient to properly fix the test.