> 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()
> The problem code manifests in TestClientInput ::wait_ for_input_ devices( ) utDeviceHub (but I don't see where yet).
>
> 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::ExternalInp
I suspect a race between mir::GLibMainLo op::pause_ processing_ for and mir::GLibMainLo op::should_ process_ actions_ for.. when it happens in this order
Mir/Input: trigger notifications due to device removal in DefaultInputDev iceHub viceHub: :changes_ complete which enqueues an action into the MainLoop :should_ process_ actions_ for g_for and destructor of ExternalInputDe viceHub: :Internal
Mir/Input: ExternalInputDe
MirMainLoop: GlibMainLoop:
main-thread: pause_processin
MirMainLoop: action()