Mir

Code review comment for lp:~alan-griffiths/mir/preserve-ExternalInputDeviceHub

Andreas Pokorny (andreas-pokorny) wrote :

> The problem code manifests in TestClientInput::wait_for_input_devices()
>
> It appears that (as the hub now lives longer than the function scope) there is
> a callback presumably after the scope is left that accesses memory that is no
> longer valid.
>
> Not sure how this happens (unless there's an exception) as remove_observer()
> is invoked before the function exits.
>
> That should not happen, so the problem seems to lie in
> mi::ExternalInputDeviceHub (but I don't see where yet).

I suspect a race between mir::GLibMainLoop::pause_processing_for and mir::GLibMainLoop::should_process_actions_for.. when it happens in this order

Mir/Input: trigger notifications due to device removal in DefaultInputDeviceHub
Mir/Input: ExternalInputDeviceHub::changes_complete which enqueues an action into the MainLoop
MirMainLoop: GlibMainLoop::should_process_actions_for
main-thread: pause_processing_for and destructor of ExternalInputDeviceHub::Internal
MirMainLoop: action()

« Back to merge proposal