diff --git a/Packages/Tracking/CHANGELOG.md b/Packages/Tracking/CHANGELOG.md index cdc993a4d..12967b453 100644 --- a/Packages/Tracking/CHANGELOG.md +++ b/Packages/Tracking/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [docs-website]: https://docs.ultraleap.com/unity-api/ "Ultraleap Docs" +## NEXT + +### Fixed +- Fixed an issue with ThreadAbortExceptions being raised during normal shutdown. +- Fixed some deprecated API usage of `Physics.autoSyncTransforms` and `XRStats.TryGetGPUTimeLastFrame` in Unity 6.3+. + ## [7.3.0] - 25/02/2026 ### Added diff --git a/Packages/Tracking/Core/Runtime/Plugins/LeapCSharp/Connection.cs b/Packages/Tracking/Core/Runtime/Plugins/LeapCSharp/Connection.cs index 2c6b681df..57eaaaed9 100644 --- a/Packages/Tracking/Core/Runtime/Plugins/LeapCSharp/Connection.cs +++ b/Packages/Tracking/Core/Runtime/Plugins/LeapCSharp/Connection.cs @@ -17,6 +17,8 @@ namespace LeapInternal public class Connection { + private const uint DEFAULT_TIMEOUT_MILLISECONDS = 150; + public struct Key { public readonly int connectionId; @@ -272,7 +274,9 @@ public void Stop() //before trying to join the worker thread. LeapC.CloseConnection(_leapConnection); - _polster.Join(); + //Using a timeout for Join() to prevent the application from hanging + //if the worker thread does not exit quickly during shutdown. + _polster.Join((int)DEFAULT_TIMEOUT_MILLISECONDS); } /// @@ -308,9 +312,7 @@ private void processMessages() } LEAP_CONNECTION_MESSAGE _msg = new LEAP_CONNECTION_MESSAGE(); - uint timeout = 150; - - result = LeapC.PollConnection(_leapConnection, timeout, ref _msg); + result = LeapC.PollConnection(_leapConnection, DEFAULT_TIMEOUT_MILLISECONDS, ref _msg); if (result != eLeapRS.eLeapRS_Success) { @@ -407,6 +409,11 @@ private void processMessages() } } //while running } + catch (ThreadAbortException) + { + // Handle thread abort gracefully without logging as this can occur under normal circumstances. + _isRunning = false; + } catch (Exception e) { Logger.Log("Exception: " + e); @@ -1031,12 +1038,11 @@ public static bool IsConnectionAvailable(string serverNamespace = "Leap Service" } LEAP_CONNECTION_MESSAGE _msg = new LEAP_CONNECTION_MESSAGE(); - uint timeout = 150; - result = LeapC.PollConnection(tempConnection, timeout, ref _msg); + LeapC.PollConnection(tempConnection, DEFAULT_TIMEOUT_MILLISECONDS, ref _msg); LEAP_CONNECTION_INFO pInfo = new LEAP_CONNECTION_INFO(); pInfo.size = (uint)Marshal.SizeOf(pInfo); - result = LeapC.GetConnectionInfo(tempConnection, ref pInfo); + LeapC.GetConnectionInfo(tempConnection, ref pInfo); if (pInfo.status == eLeapConnectionStatus.eLeapConnectionStatus_Connected) {