Application crashes on exit in 64bit

Skip to first unread message


Nov 18, 2020, 1:58:15 PM11/18/20
to wx-users
Hello and good evening,
I have some application(s) running successfully using wxwidgets 3.1.3 in 32bit, Windows 7, even runs fine on linux, build runs fine on windows 10 too.
Toolchain is TDM GCC with GCC 9.2. I have tried with 3.1.4, compiling both the 64 bit version using the 64bit directory (default TDM-GCC-64) and the 32bit using the 32bit directory TDM-GCC-32. Debugger is the 64bit Debugger for 64bit builds and the "normal" 32bit for 32bit builds. Debugging works fine after using a nightly build of Code::Blocks with 64bit. Setting up compiler and toolchain worked so I'm on a 64bit compiler, debugger and IDE.
32 bit is cool. 64bit builds crash when exiting the application in debug (haven't tried release yet) with some exception in a textctrl (which each of my application uses, there is none without it). I highly doubt that this is the reason for the CTD when exiting the application though. The debugger catches 2 exceptions which it can't really find, each one with a stack pointing to the destructor of wxTextCtrl.
It happens with each of my applications which have little in common (except every application uses a wxTextCtrl somewhere), in each one the 32bit build is fine. The application itself is doing fine until it is exited. Output says I'm on the 64bit debugger and compiler.
I have already checked for forgotten events, missing deletes or something, but there are none. I ported working applications which are really stable in 32bit to 64bit.
Any idea what I could have been doing wrong?
The stack is:
#0 0x76f8f230    ntdll!RtlUnhandledExceptionFilter() (C:\Windows\SYSTEM32\ntdll.dll:??)
#1 0x76f8f836    ntdll!EtwEnumerateProcessRegGuids() (C:\Windows\SYSTEM32\ntdll.dll:??)
#2 0x76f90452    ntdll!RtlQueryProcessLockInformation() (C:\Windows\SYSTEM32\ntdll.dll:??)
#3 0x76f92564    ntdll!RtlLogStackBackTrace() (C:\Windows\SYSTEM32\ntdll.dll:??)
#4 0x76efa232    ntdll!RtlFreeHeap() (C:\Windows\SYSTEM32\ntdll.dll:??)
#5 0x7fefee710c8    msvcrt!free() (C:\Windows\system32\msvcrt.dll:??)
#6 0x12a44bd    std::locale::_Impl::~_Impl() () (C:\wxGccTDM314\lib\gcc_dll64\wxmsw314ud_core_gcc_cb.dll:??)
#7 0x12a4920    std::locale::~locale() () (C:\wxGccTDM314\lib\gcc_dll64\wxmsw314ud_core_gcc_cb.dll:??)
#8 0x1153e0f    wxTextCtrlBase::~wxTextCtrlBase(this=0xc01dc70, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../include/wx/textctrl.h:693)
#9 0xe49951    wxTextCtrl::~wxTextCtrl(this=0xc01dc70, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../src/msw/textctrl.cpp:354)
#10 0xe49991    wxTextCtrl::~wxTextCtrl(this=0xc01dc70, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../src/msw/textctrl.cpp:365)
#11 0xf45f26    wxWindowBase::Destroy(this=0xc01dc70) (C:\wxGccTDM314_64\build\msw/../../src/common/wincmn.cpp:578)
#12 0xf46085    wxWindowBase::DestroyChildren(this=0xc0178d0) (C:\wxGccTDM314_64\build\msw/../../src/common/wincmn.cpp:610)
#13 0xdb68ec    wxWindow::~wxWindow(this=0xc0178d0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../src/msw/window.cpp:483)
#14 0x117bdd8    wxNavigationEnabled<wxWindow>::~wxNavigationEnabled(this=0xc0178d0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../include/wx/containr.h:189)
#15 0x1135e4a    wxPanelBase::~wxPanelBase(this=0xc0178d0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../include/wx/panel.h:30)
#16 0x11c0d26    wxPanel::~wxPanel(this=0xc0178d0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../include/wx/msw/panel.h:19)
#17 0x11c0ce5    wxPanel::~wxPanel(this=0xc0178d0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../include/wx/msw/panel.h:19)
#18 0xf45f26    wxWindowBase::Destroy(this=0xc0178d0) (C:\wxGccTDM314_64\build\msw/../../src/common/wincmn.cpp:578)
#19 0xf46085    wxWindowBase::DestroyChildren(this=0xbfddae0) (C:\wxGccTDM314_64\build\msw/../../src/common/wincmn.cpp:610)
#20 0xdb68ec    wxWindow::~wxWindow(this=0xbfddae0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../src/msw/window.cpp:483)
#21 0xe85fb8    wxControlBase::~wxControlBase(this=0xbfddae0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../src/common/ctrlcmn.cpp:48)
#22 0x11e7c8c    wxControl::~wxControl(this=0xbfddae0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../include/wx/msw/control.h:17)
#23 0x114d347    wxBookCtrlBase::~wxBookCtrlBase(this=0xbfddae0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../include/wx/bookctrl.h:55)
#24 0x1152aa3    wxNotebookBase::~wxNotebookBase(this=0xbfddae0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../include/wx/notebook.h:103)
#25 0xe2552d    wxNotebook::~wxNotebook(this=0xbfddae0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../src/msw/notebook.cpp:296)
#26 0xe25553    wxNotebook::~wxNotebook(this=0xbfddae0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../src/msw/notebook.cpp:302)
#27 0xf45f26    wxWindowBase::Destroy(this=0xbfddae0) (C:\wxGccTDM314_64\build\msw/../../src/common/wincmn.cpp:578)
#28 0xf46085    wxWindowBase::DestroyChildren(this=0xbfdd1e0) (C:\wxGccTDM314_64\build\msw/../../src/common/wincmn.cpp:610)
#29 0xdb68ec    wxWindow::~wxWindow(this=0xbfdd1e0, __in_chrg=<optimized out>) (C:\wxGccTDM314_64\build\msw/../../src/msw/window.cpp:483)

(on windows 7, 64bit, german system)
Thank you everyone!
Regards, Tobias

Vadim Zeitlin

Nov 19, 2020, 7:19:48 AM11/19/20
On Wed, 18 Nov 2020 10:58:14 -0800 (PST) TobiasA wrote:

T> Any idea what I could have been doing wrong?

It's really hard to say, but I see only 2 possibilities:

1. You're corrupting the heap somewhere and it just gets randomly detected
when destroying wxTextCtrl. In this case you should try running your
program under some kind of memory debugger. I don't believe gcc supports
ASAN under MSW yet (although MSVS does now!), but you could at least try
enabling heap debugging flags with gflags.

2. There is something weird with std::streambuf specifically in this TDM
version. In this case you could try editing wx/textctrl.h and setting
wxHAS_TEXT_WINDOW_STREAM to 0 there to disable inheriting wxTextCtrl
from std::streambuf and see if it helps.

Good luck,

TT-Solutions: wxWidgets consultancy and technical support
Message has been deleted

Eric Jensen

Nov 19, 2020, 7:26:18 AM11/19/20
to TobiasA
Hello TobiasA,

Wednesday, November 18, 2020, 7:58:14 PM, you wrote:

T> ntdll!RtlUnhandledExceptionFilter()
T> (C:\Windows\SYSTEM32\ntdll.dll:??)
T> #1 0x76f8f836 ntdll!EtwEnumerateProcessRegGuids()
T> (C:\Windows\SYSTEM32\ntdll.dll:??)
T> #2 0x76f90452 ntdll!RtlQueryProcessLockInformation()
T> (C:\Windows\SYSTEM32\ntdll.dll:??)
T> #3 0x76f92564 ntdll!RtlLogStackBackTrace()
T> (C:\Windows\SYSTEM32\ntdll.dll:??)
T> #4 0x76efa232 ntdll!RtlFreeHeap()
T> (C:\Windows\SYSTEM32\ntdll.dll:??)
T> #5 0x7fefee710c8 msvcrt!free() (C:\Windows\system32\msvcrt.dll:??)
T> #6 0x12a44bd std::locale::_Impl::~_Impl() ()
T> (C:\wxGccTDM314\lib\gcc_dll64\wxmsw314ud_core_gcc_cb.dll:??)
T> #7 0x12a4920 std::locale::~locale() ()
T> (C:\wxGccTDM314\lib\gcc_dll64\wxmsw314ud_core_gcc_cb.dll:??)
T> #8 0x1153e0f wxTextCtrlBase::~wxTextCtrlBase(this=0xc01dc70,
T> __in_chrg=<optimized out>)
T> (C:\wxGccTDM314_64\build\msw/../../include/wx/textctrl.h:693)
T> #9 0xe49951 wxTextCtrl::~wxTextCtrl(this=0xc01dc70,
T> __in_chrg=<optimized out>)
T> (C:\wxGccTDM314_64\build\msw/../../src/msw/textctrl.cpp:354)
T> #10 0xe49991 wxTextCtrl::~wxTextCtrl(this=0xc01dc70,
T> __in_chrg=<optimized out>)

There's a thread about an identical crash (std::locale::~locale()
destructor) in CodeBlocks itself:,23642.msg161690.html#msg161690

Maybe it helps


BTW: I don't use MinGW, but it it normal that there are only 32bit
addresses (with one exception) in this stack trace?

Message has been deleted


Nov 19, 2020, 8:05:38 AM11/19/20
to wx-users
Thanks Vadim and Eric,
I think I'm not corrupting the heap since it works fine in 32bit and wx 3.1.3 (and has in 3.1.0 and 3.1.2).
So it must be the streambuf thing and yes, the std::locale issue on code::blocks looks exactly like what I am experiencing.
I can exactly reproduce everything whenever I destroy a textctrl. Guess I'll revive the thread over there at the c::b forums.

The 32 bit adresses are probably by starting the application and closing it again without actually doing anything in the application.


Nov 19, 2020, 8:20:41 AM11/19/20
to wx-users
@asmwarrior: I don't know why your message gets deleted, but I see it in my mail inbox.
Just curious, which compiler do you use on windows? I really like TDM because it worked out-of-the-box with no further hazzle and supports C++17.

Павел Тюнин

Nov 21, 2020, 8:09:28 AM11/21/20
to wx-users
I had a similar problem with pre-built 9.2 32bit DLLs. My app crashed when closing a modal dialog with wxTextCtrl and when switching between text fields in wxPropertyGrid. It works correctly when using 8.1 DLLs.

четверг, 19 ноября 2020 г. в 15:20:41 UTC+2, TobiasA:

Igor Korot

Nov 21, 2020, 9:05:31 AM11/21/20
Hi. Pavel,

On Sat, Nov 21, 2020, 7:09 AM Павел Тюнин <> wrote:
I had a similar problem with pre-built 9.2 32bit DLLs. My app crashed when closing a modal dialog with wxTextCtrl and when switching between text fields in wxPropertyGrid. It works correctly when using 8.1 DLLs.

What versions exactly do you use?
There is no 9.2, nor 8.1..

Thank you.

Please read before posting.
To unsubscribe, send email to
or visit
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit


Nov 21, 2020, 9:10:24 AM11/21/20
to wx-users
The latest TDM GCC is based on GCC 9.2 while the latest MinGW 64 is based on GCC 8.1 iirc. 
I have not tried the latter one yet. 

Павел Тюнин

Nov 21, 2020, 9:18:18 AM11/21/20
to wx-users
I used wxMSW-3.1.4_gcc920TDM_Dev.7z and wxMSW-3.1.4_gcc810_Dev.7z from GitHub release page and TDM GCC 9.2 compiler.

суббота, 21 ноября 2020 г. в 16:10:24 UTC+2, TobiasA:
Reply all
Reply to author
0 new messages