Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Packages/Tracking/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ 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.

## [7.3.0] - 25/02/2026

### Added
Expand Down
20 changes: 13 additions & 7 deletions Packages/Tracking/Core/Runtime/Plugins/LeapCSharp/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ namespace LeapInternal

public class Connection
{
private const uint DEFAULT_TIMEOUT_MILLISECONDS = 150;

public struct Key
{
public readonly int connectionId;
Expand Down Expand Up @@ -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);
}

/// <summary>
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down