Fix segmentation fault with GCC winthreads by adding null checks patch#973
Draft
Fix segmentation fault with GCC winthreads by adding null checks patch#973
Conversation
Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix segmentation fault with gcc winthreads
Fix segmentation fault by switching GCC from win32 to posix threads
Jan 17, 2026
Member
Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
Author
Understood. I've reverted to win32 threads and added a GCC patch ( |
…umbers Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
Copilot
AI
changed the title
Fix segmentation fault by switching GCC from win32 to posix threads
Fix segmentation fault with GCC winthreads by adding null checks patch
Jan 17, 2026
Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
Author
Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
Member
|
The patch does not apply: |
Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
Author
Fixed. The hunk header had incorrect line counts (@@ -95,9 +95,18 @@ should have been @@ -95,11 +95,21 @@). The patch now applies cleanly. Commit: 8d98a4d Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix GCC Segmentation Fault with winthreads ✅
Issue Analysis
Solution: Apply GCC patch for win32 threads atexit issue
Technical Details
Cannot switch to POSIX threads due to Qt incompatibility (QTBUG-131892 - MinGW winpthreads bug). Instead, this fix:
MXE_GCC_THREADSset towin32as required by Qtgcc-2-atexit-thread-fix.patch) that guards against invalid thread data inlibstdc++-v3/libsupc++/atexit_thread.cceltandelt->headbefore accessing them during DLL cleanupelt->headin inner loop to handle potential race conditionselt->head->functo detect corrupted atexit chains__MINGW32__&&!_GLIBCXX_HAS_GTHREADS)ucrtbase!_execute_onexit_tableduring program exitChanges
settings.mk:MXE_GCC_THREADSremainswin32src/gcc-2-atexit-thread-fix.patch: Guards against null thread data during atexit cleanup with proper unified diff format and correct line countsOriginal prompt
This section details on the original issue you should resolve
<issue_title>Segmentation fault with gcc winthreads</issue_title>
<issue_description>```
Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ff805c229f7 in (anonymous namespace)::run (p=) at /home/jonas/Projects/strawberry/strawberry-mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-15.1.0/libstdc++-v3/libsupc++/atexit_thread.cc:98
warning: 98 /home/jonas/Projects/strawberry/strawberry-mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-15.1.0/libstdc++-v3/libsupc++/atexit_thread.cc: No such file or directory
(gdb) bt
strawberrymusicplayer/strawberry-mxe#0 0x00007ff805c229f7 in (anonymous namespace)::run (p=) at /home/jonas/Projects/strawberry/strawberry-mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-15.1.0/libstdc++-v3/libsupc++/atexit_thread.cc:98
#1 0x00007ff889a342d6 in ucrtbase!_execute_onexit_table () from C:\Windows\System32\ucrtbase.dll
#2 0x00007ff889a341fb in ucrtbase!_execute_onexit_table () from C:\Windows\System32\ucrtbase.dll
#3 0x00007ff889a341b4 in ucrtbase!execute_onexit_table () from C:\Windows\System32\ucrtbase.dll
#4 0x00007ff805bf1092 in CRT_INIT (hDllHandle=hDllHandle@entry=0x7ff805bf0000, dwReason=dwReason@entry=0, lpreserved=lpreserved@entry=0x1) at ../gcc-15.1.0.build/mingw-w64-v13.0.0/mingw-w64-crt/crt/crtdll.c:126
#5 0x00007ff805bf123b in DllMainCRTStartup (hDllHandle=0x7ff805bf0000, dwReason=0, lpreserved=0x1) at ../gcc-15.1.0.build/mingw-w64-v13.0.0/mingw-w64-crt/crt/crtdll.c:172
#6 0x00007ff88bfc9a1d in ntdll!RtlActivateActivationContextUnsafeFast () from C:\Windows\SYSTEM32\ntdll.dll
#7 0x00007ff88c00f1ca in ntdll!LdrShutdownProcess () from C:\Windows\SYSTEM32\ntdll.dll
#8 0x00007ff88c00ef7d in ntdll!RtlExitUserProcess () from C:\Windows\SYSTEM32\ntdll.dll
#9 0x00007ff88ad4e3eb in KERNEL32!FatalExit () from C:\Windows\System32\kernel32.dll
#10 0x00007ff889a405bc in ucrtbase!exit () from C:\Windows\System32\ucrtbase.dll
#11 0x00007ff889a4045f in ucrtbase!exit () from C:\Windows\System32\ucrtbase.dll
#12 0x00007ff6ebd313d9 in tmainCRTStartup () at ../gcc-15.1.0.build/mingw-w64-v13.0.0/mingw-w64-crt/crt/crtexe.c:238
#13 0x00007ff6ebd31416 in mainCRTStartup () at ../gcc-15.1.0.build/mingw-w64-v13.0.0/mingw-w64-crt/crt/crtexe.c:122
Thread 1 received signal SIGSEGV, Segmentation fault.
(anonymous namespace)::run (p=) at /mnt/data2/build/strawberry-mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-14.2.0/libstdc++-v3/libsupc++/atexit_thread.cc:98
warning: 98 /mnt/data2/build/strawberry-mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-14.2.0/libstdc++-v3/libsupc++/atexit_thread.cc: No such file or directory
(gdb) bt
strawberrymusicplayer/strawberry-mxe#0 (anonymous namespace)::run (p=) at /mnt/data2/build/strawberry-mxe/tmp-gcc-x86_64-w64-mingw32.shared/gcc-14.2.0/libstdc++-v3/libsupc++/atexit_thread.cc:98
#1 0x00007ffd17d342d6 in ucrtbase!_execute_onexit_table () from C:\Windows\System32\ucrtbase.dll
#2 0x00007ffd17d341fb in ucrtbase!_execute_onexit_table () from C:\Windows\System32\ucrtbase.dll
#3 0x00007ffd17d341b4 in ucrtbase!execute_onexit_table () from C:\Windows\System32\ucrtbase.dll
#4 0x00007ffca8d91097 in CRT_INIT (hDllHandle=hDllHandle@entry=0x7ffca8d90000, dwReason=dwReason@entry=0, lpreserved=lpreserved@entry=0x1) at ../gcc-14.2.0.build/mingw-w64-v13.0.0/mingw-w64-crt/crt/crtdll.c:126
#5 0x00007ffca8d91250 in DllMainCRTStartup (hDllHandle=0x7ffca8d90000, dwReason=0, lpreserved=0x1) at ../gcc-14.2.0.build/mingw-w64-v13.0.0/mingw-w64-crt/crt/crtdll.c:172
#6 0x00007ffd19fa9a1d in ntdll!RtlActivateActivationContextUnsafeFast () from C:\Windows\SYSTEM32\ntdll.dll
#7 0x00007ffd19fef1ca in ntdll!LdrShutdownProcess () from C:\Windows\SYSTEM32\ntdll.dll
#8 0x00007ffd19feef7d in ntdll!RtlExitUserProcess () from C:\Windows\SYSTEM32\ntdll.dll
#9 0x00007ffd18fee3eb in KERNEL32!FatalExit () from C:\Windows\System32...
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.