Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix SIGBUS crash in wechat_qrcode during process shutdown#4039

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
0AnshuAditya0 wants to merge7 commits intoopencv:5.x
base:5.x
Choose a base branch
Loading
from0AnshuAditya0:fix-wechat-qrcode-shutdown-crash

Conversation

@0AnshuAditya0
Copy link

Fixesopencv/opencv#27971

Problem:
Double-free crash in std::vector<zxing::Refzxing::qrcode::Version>::~vector()
during process shutdown when using wechat_qrcode module. The crash occurred with
error "free(): double free detected in tcache 2" and SIGBUS signal.

Root Cause:
Static member variable VERSIONS was destroyed during shutdown while Ref
objects still held references, causing double-free due to static initialization
order fiasco.

Solution:
Converted static member variable to Meyer's singleton pattern with heap allocation.
The vector is intentionally never destroyed, preventing the double-free during
shutdown. This is a standard pattern for avoiding static destruction order issues.

Changes:

  • version.hpp: Changed VERSIONS declaration to getVersions() function
  • version.cpp: Implemented getVersions() with function-local static pointer
  • version.cpp: Updated all 15+ references to use getVersions() instead of VERSIONS

Testing:

  • Existing tests pass without crashes
  • No SIGBUS crash on shutdown
  • Small intentional memory "leak" (singleton pattern) is acceptable

Fixesopencv/opencv#27971Problem:Double-free crash in std::vector<zxing::Ref<zxing::qrcode::Version>>::~vector()during process shutdown when using wechat_qrcode module. The crash occurred witherror "free(): double free detected in tcache 2" and SIGBUS signal.Root Cause:Static member variable VERSIONS was destroyed during shutdown while Ref<Version>objects still held references, causing double-free due to static initializationorder fiasco.Solution:Converted static member variable to Meyer's singleton pattern with heap allocation.The vector is intentionally never destroyed, preventing the double-free duringshutdown. This is a standard pattern for avoiding static destruction order issues.Changes:- version.hpp: Changed VERSIONS declaration to getVersions() function- version.cpp: Implemented getVersions() with function-local static pointer- version.cpp: Updated all 15+ references to use getVersions() instead of VERSIONSTesting:- Existing tests pass without crashes- No SIGBUS crash on shutdown- Small intentional memory "leak" (singleton pattern) is acceptable
@0AnshuAditya00AnshuAditya0 changed the base branch from4.x to5.xNovember 21, 2025 10:41
@0AnshuAditya00AnshuAditya0 changed the base branch from5.x to4.xNovember 21, 2025 10:42
@0AnshuAditya00AnshuAditya0 changed the base branch from4.x to5.xNovember 21, 2025 10:42
@0AnshuAditya00AnshuAditya0 changed the base branch from5.x to4.xNovember 23, 2025 03:07
@0AnshuAditya00AnshuAditya0 changed the base branch from4.x to5.xNovember 23, 2025 03:15
@0AnshuAditya00AnshuAditya0force-pushed thefix-wechat-qrcode-shutdown-crash branch 3 times, most recently fromcc5ccb7 to2286562CompareNovember 25, 2025 13:39
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@asmorkalovasmorkalovAwaiting requested review from asmorkalov

Assignees

@asmorkalovasmorkalov

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

SIGBUS Crash in OpenCV 4.10 ZXing Library During Process Shutdown

2 participants

@0AnshuAditya0@asmorkalov

[8]ページ先頭

©2009-2025 Movatter.jp