Skip to content

Fix libinput abort on input thread tear down

We didn't tear down the libinput objects in the right thread when exiting, but did so after the input thread exited.

We also tried to destroy the libinput devices after the libinput context was destroyed, which isn't allowed.

Fix these two issues by tearing down the libinput objects in a input thread task that when done exits the input thread. This effectively "flushes" the input thread tasks while destroying the libinput objects just before the thread exits.

While it might fine to tear down libinput objects in an arbitrary (main in this case) thread while making sure nothing pokes at it in parallel (e.g. the input thread is gone), libinput is by definition single threaded, and could theoretically make assumptions about this, and we shouldn't cause any possible surprises here, so make sure to destroy it all in the right thread.

This fixes an abort() on exit caused by an assert about invalid object destruction in libinput.

Merge request reports