Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when unsubscribing / resubscribing #33

Closed
evilC opened this issue Aug 4, 2019 · 1 comment
Closed

Crash when unsubscribing / resubscribing #33

evilC opened this issue Aug 4, 2019 · 1 comment
Labels

Comments

@evilC
Copy link
Owner

evilC commented Aug 4, 2019

Firing unsubscribe sometime causes a lockup when the last subscription is removed from a device.
The DeviceEmptyHandler in SharpDX_DirectInput seems to be crashing when calling _activeDevices[e].Dispose()

        private void DeviceEmptyHandler(object sender, DeviceDescriptor e)
        {
            _logger.Log($"Device {e.DeviceHandle} instance {e.DeviceInstance} is empty, disposing...");
            _activeDevices[e].Dispose();
            _activeDevices.TryRemove(e, out _);
        }

This calls PollingDeviceHandlerBase's Dispose() method

        public override void Dispose()
        {
            _pollThread.Abort();
            _pollThread.Join();
            _pollThread = null;
        }

When running in Visual Studio, it always works, but sometimes, if not running in Visual Studio, it hangs on the line _pollthread.Join();

@evilC evilC added the bug label Aug 4, 2019
evilC added a commit that referenced this issue Aug 5, 2019
Remove use of Thread.Abort to kill PollThreads, use flags to signal to PollThread to end instead.
Add Init() method to PollingDeviceHandler and start thread in there - starting thread in ctor of PollingDeviceHandler meant that thread was started before derived DiDeviceHandler had initialized
@evilC
Copy link
Owner Author

evilC commented Aug 10, 2019

Fixed in 0.10.6

@evilC evilC closed this as completed Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant