Skip to content

fix(scodes): update SCodes to get a crash fix on Windows#21115

Open
jrainville wants to merge 1 commit into
release/2.38.xfrom
fix/windows-qr-termination-crash
Open

fix(scodes): update SCodes to get a crash fix on Windows#21115
jrainville wants to merge 1 commit into
release/2.38.xfrom
fix/windows-qr-termination-crash

Conversation

@jrainville
Copy link
Copy Markdown
Member

@jrainville jrainville commented Jun 2, 2026

Fixes #21034

Summary

This PR updates the StatusQ SCodes dependency to include a fix for a Windows crash in the Log in by syncing flow.

Problem

On Windows, repeatedly entering and exiting the syncing QR flow (Continue -> Back -> Continue) could trigger an access violation during QML teardown.
WinDbg stacks consistently pointed to Qt6Core!QThread::terminate in the scanner teardown path.

Root Cause

The QR scanner worker thread in SCodes (SBarcodeScanner) used a Windows-specific forced thread stop (terminate()) in the destructor.
During rapid view teardown/recreation, this could race with in-flight decode work and posted Qt events, causing invalid access.

Fix

The SCodes scanner shutdown was hardened to use an orderly teardown sequence instead of forced termination:

  • stop scanning and prevent new frame processing
  • disconnect frame delivery
  • stop/detach camera and capture session
  • queue a blocking barrier on the decoder thread to drain already-queued work
  • call quit() + wait() for clean thread shutdown

Also included small safety guards to avoid processing/logging against a cleared camera during teardown.

Dependency Update

StatusQ now pins SCodes to:

2b46818ff46fd43f443ed80a056c01abcf927526

in CMakeLists.txt.

Affected areas

SCodes (PR: status-im/SCodes#4)

Quality checklist

Screencapture of the functionality

Linux syncing:

syncing-fix.webm

Linux QR Scanner:

qr-still-works.webm

Windows Syncing:

windows-syncing.mp4

Windows QR scanner:

windows-qr.mp4

Impact on end user

It should make opening and closing the QR scanner more resilient to crashes

How to test

Tested on Windows and Ubuntu

Risk

Low/Medium - We need to check that the QR scanner still works as expected on all platforms. The library was a bit "flaky" when I integrated it. It would work on one platform, but freeze on another. In theory, the build system should still be ok and the code is safe, but let's test before merging.

@status-im-auto
Copy link
Copy Markdown
Member

status-im-auto commented Jun 2, 2026

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ b74b946 1 2026-06-02 17:50:54 ~7 min tests/nim 📄log
✔️ b74b946 1 2026-06-02 17:53:24 ~10 min android/arm64 🤖apk 📲
✔️ b74b946 1 2026-06-02 17:53:35 ~10 min ios/aarch64 📱ipa 📲
✔️ b74b946 1 2026-06-02 17:54:54 ~11 min tests/ui 📄log
✔️ b74b946 1 2026-06-02 17:56:44 ~13 min macos/aarch64 🍎dmg
✔️ b74b946 1 2026-06-02 17:59:11 ~16 min linux/x86_64 📦tgz
✔️ b74b946 1 2026-06-02 18:05:36 ~22 min windows/x86_64 💿exe
✔️ b74b946 11561 2026-06-02 18:15:34 ~16 min tests/e2e 📊rpt
✔️ b74b946 3495 2026-06-02 18:27:54 ~22 min tests/e2e-windows 📊rpt
✖️ b74b946 3649 2026-06-02 19:39:38 ~1 hr 46 min tests/e2e-android 📦pkg

@jrainville
Copy link
Copy Markdown
Member Author

I tested the Android build and the QR scanner still works as expected

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.

Starting 2 app instances on windows leads to Illegal storage access error (sporadically)

3 participants