Conversation
IOConfigurator::Shutdown() called libusb_exit() while PacDriveSingleton still held open handles. That singleton is static, so its destructor ran at process exit and closed handles whose context was already freed, segfaulting in libusb_close. Same shape as 7a61d55, which put Pinscape::ClearDevices() ahead of hid_exit() in this function. ReacquireContext() re-enumerates after libusb_init so a second DOF instance still finds its devices.
Author
|
Resolved by 69b10bd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Any process that opens a PacDrive/PacLed64 segfaults at exit inside
libusb_close:IOConfigurator::Shutdown()callslibusb_exit()whilePacDriveSingletonstill holds open handles. That singleton is static, so its destructor runs at process exit and closes handles whose context is already gone.Same bug you fixed for hidapi in 7a61d55, which put
Pinscape::ClearDevices()ahead ofhid_exit()in this function. The libusb branch never got the equivalent.ReacquireContext()isn't cosmetic: without it the singleton stays empty after the first teardown and a second DOF instance silently finds no PacLed64 — a crash traded for missing outputs.Repro:
Init(),Finish(), destroy, exit, with a PacLed64 attached. Everything logs a clean shutdown, then the process dies with signal 11. 3/3 before, 0/3 after.Tested on Debian 13 x64 against a PacLed64 and a LedWiz on an Ultimarc board, standalone and under a frontend doing repeated start/stop cycles. Only the libusb/PacDrive path — no FTDI, PinOne, or Pinscape hardware here, and no Windows/macOS build.
AI-generated fix, disclosed per CONTRIBUTING.md. I found and verified the bug on hardware; the patch itself was AI-generated, so it's a draft and a starting point rather than a finished contribution — treat the design as a proposal.