Skip to content

Conversation

@cagnulein
Copy link
Owner

This commit eliminates QEventLoop::exec() calls in Bluetooth write operations for domyostreadmill and wahookickrsnapbike devices, which were causing crashes on iOS due to nested event loop incompatibilities.

Changes:

  • Replaced synchronous loop.exec() with async queue-based system
  • Implemented WriteRequest queue with processWriteQueue() method
  • Added timeout management with QTimer for async operations
  • Updated characteristicWritten/packetReceived handlers for queue processing
  • Removed all #ifdef Q_OS_IOS conditionals in wahookickrsnapbike
  • Unified Bluetooth handling code across all platforms using pure Qt

The new architecture:

  1. writeCharacteristic() enqueues write requests instead of blocking
  2. processWriteQueue() handles requests sequentially
  3. Completion signals (characteristicWritten/packetReceived) trigger next item
  4. Timeout handling prevents queue stalls without blocking main thread

This eliminates the problematic pattern of calling loop.exec() from within the main event loop, which was causing watchdog timeouts and crashes on iOS. The solution is cross-platform compatible and improves responsiveness on all platforms.

Fixes iOS crash issues related to nested event loops in Bluetooth operations.

claude and others added 4 commits December 31, 2025 11:07
This commit eliminates QEventLoop::exec() calls in Bluetooth write
operations for domyostreadmill and wahookickrsnapbike devices, which
were causing crashes on iOS due to nested event loop incompatibilities.

Changes:
- Replaced synchronous loop.exec() with async queue-based system
- Implemented WriteRequest queue with processWriteQueue() method
- Added timeout management with QTimer for async operations
- Updated characteristicWritten/packetReceived handlers for queue processing
- Removed all #ifdef Q_OS_IOS conditionals in wahookickrsnapbike
- Unified Bluetooth handling code across all platforms using pure Qt

The new architecture:
1. writeCharacteristic() enqueues write requests instead of blocking
2. processWriteQueue() handles requests sequentially
3. Completion signals (characteristicWritten/packetReceived) trigger next item
4. Timeout handling prevents queue stalls without blocking main thread

This eliminates the problematic pattern of calling loop.exec() from
within the main event loop, which was causing watchdog timeouts and
crashes on iOS. The solution is cross-platform compatible and improves
responsiveness on all platforms.

Fixes iOS crash issues related to nested event loops in Bluetooth operations.
@SpykeYs SpykeYs mentioned this pull request Jan 2, 2026
@cagnulein cagnulein merged commit 681eaff into master Jan 12, 2026
14 checks passed
@cagnulein cagnulein deleted the claude/analyze-ios-bluetooth-crashes-A6x2l branch January 12, 2026 08:37
@cagnulein cagnulein added this to the 2.20 milestone Jan 12, 2026
@cagnulein
Copy link
Owner Author

reference: ssssgibbs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants