1
When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.
if(!buffErr.IsEmpty() && m_notifiedWindow) {
// we got some data, send event to parent
//clProcessEvent e(wxEVT_ASYNC_PROCESS_STDERR);
wxThreadEvent e(wxEVT_ASYNC_PROCESS_STDERR, wxID_NONE);
//wxString& b = const_cast<wxString&>(e.GetOutput());
//b.swap(buffErr);
//e.SetProcess(m_process);
//m_notifiedWindow->AddPendingEvent(e);
//-std::string stdstr = buffErr.ToStdString(); loses data
#if wxCHECK_VERSION(3,1,5)
std::string stdstr = buff.utf8_string();
#else
std::string stdstr = buff.ToStdString(wxConvUTF8);
#endif
e.SetPayload<std::string*>(&stdstr);
m_notifiedWindow->ProcessEvent(e);
}
#0 wxRecursionGuard::~wxRecursionGuard (this=0xb84f920, __in_chrg=<optimized out>) at F:\code\wxWidgets-3.3.1\include\wx\recguard.h:38
__func__ = <optimized out>
#1 0x00007ffe78da8e51 in wxEvtHandler::SearchDynamicEventTable (this=0xa4b8fa0, event=...) at F:\code\wxWidgets-3.3.1\src\common\event.cpp:1961
__func__ = "SearchDynamicEventTable"
localCopy = {m_ref = 0xa4b6530}
dynamicEvents = @0x800de80: {m_entries = std::vector of length 7, capacity 8 = {0xa44e0c0, 0x80117b0, 0x800df70, 0xa47bd40, 0x800e1f0, 0xa4b8ab0, 0xa4b8b50}, m_flag = 0}
guard = {m_flag = @0x800de98, m_isInside = false}
needToPruneDeleted = false
#2 0x00007ffe78da8395 in wxEvtHandler::TryHereOnly (this=0xa4b8fa0, event=...) at F:\code\wxWidgets-3.3.1\src\common\event.cpp:1650
No locals.
#3 0x00007ffe7970d030 in wxEvtHandler::TryBeforeAndHere (this=0xa4b8fa0, event=...) at F:\code\wxWidgets-3.3.1\include\wx\event.h:4072
No locals.
#4 0x00007ffe78da8200 in wxEvtHandler::ProcessEventLocally (this=0xa4b8fa0, event=...) at F:\code\wxWidgets-3.3.1\src\common\event.cpp:1587
No locals.
#5 0x00007ffe78da8199 in wxEvtHandler::ProcessEvent (this=0xa4b8fa0, event=...) at F:\code\wxWidgets-3.3.1\src\common\event.cpp:1560
__func__ = "ProcessEvent"
#6 0x00007ffed671a689 in ProcessReaderThread::Entry (this=0xa4b84d0) at F:\code\codeblocks-src\codeblocks_sfmirror\src\plugins\contrib\clangd_client\src\winprocess\asyncprocess\processreaderthread.cpp:107
e = {<wxEvent> = {<wxObject> = {_vptr.wxObject = 0x7ffe79d6de50 <vtable for wxThreadEvent+16>, static ms_classInfo = {m_className = 0x7ffe79b21882 <wxFalse+1104> L"wxObject", m_objectSize = 16, m_objectConstructor = 0x0, m_baseInfo1 = 0x0, m_baseInfo2 = 0x0, static sm_first = 0x7ffedb4c4020 <wxSpeedButton::ms_classInfo>, m_next = 0x7ffe7a0b0980 <wxProcessEvent::ms_classInfo>, static sm_classTable = 0x6e46e0}, m_refData = 0x0}, m_eventObject = 0x0, m_eventType = 10604, m_timeStamp = 0, m_id = -3, m_callbackUserData = 0x0, m_handlerToProcessOnlyIn = 0x0, m_propagationLevel = 0, m_propagatedFrom = 0x0, m_skipped = false, m_isCommandEvent = false, m_wasProcessed = true, m_willBeProcessedAgain = false, static ms_classInfo = {m_className = 0x7ffe79b3543a <EVENT_TYPE_TABLE_INIT_SIZE+1874> L"wxEvent", m_objectSize = 80, m_objectConstructor = 0x0, m_baseInfo1 = 0x7ffe7a0b0680 <wxObject::ms_classInfo>, m_baseInfo2 = 0x0, static sm_first = 0x7ffedb4c4020 <wxSpeedButton::ms_classInfo>, m_next = 0x7ffe7a0b19c0 <wxEvtHandler::ms_classInfo>}}, <wxEventAnyPayloadMixin> = {<wxEventBasicPayloadMixin> = {m_cmdString = L"", m_commandInt = 0, m_extraLong = 0}, m_payload = {m_buffer = {m_alignment = {m_int64 = 193264352, m_longDouble = <invalid float value>, m_funcPtr = 0xb84fae0, m_mFuncPtr = (void (wxAnyValueBuffer::*)(wxAnyValueBuffer * const)) 0xb84fae0, this adjustment 281472023920739}, m_ptr = 0xb84fae0, m_buffer = "帔\204\v\000\000\000\000c\000\000P\377\377\000"}, m_type = 0x67405e0}}, static ms_classInfo = {m_className = 0x7ffe79b35462 <EVENT_TYPE_TABLE_INIT_SIZE+1914> L"wxThreadEvent", m_objectSize = 176, m_objectConstructor = 0x7ffe78da4378 <wxThreadEvent::wxCreateObject()>, m_baseInfo1 = 0x7ffe7a0b1a00 <wxEvent::ms_classInfo>, m_baseInfo2 = 0x0, static sm_first = 0x7ffedb4c4020 <wxSpeedButton::ms_classInfo>, m_next = 0x7ffe7a0b1a40 <wxIdleEvent::ms_classInfo>}}
stdstr = ""
buff = L""
buffErr = L"V[16:11:47.077] Dropped diagnostic: F:/code/wxWidgets-3.3.1/include/wx/bitmap.h: 'wxBitmap::ConvertToDisabled' redeclared inline; 'dllimport' attribute ignored\r\nI[16:11:47.087] Built preamble of size "...
#7 0x00007ffe78d93a04 in operator() (__closure=0xb84fe40) at F:\code\wxWidgets-3.3.1\src\msw\thread.cpp:528
__func__ = "operator()"
thread = @0xb84fe80: 0xa4b84d0
rc = @0xb84fe1c: 4294967295
#8 0x00007ffe78d97ce3 in wxSafeCall<void, wxThreadInternal::DoThreadStart(wxThread*)::<lambda()>, void()>(const struct {...} &, void (&)(void)) (func=..., handler=@0x7ffe78cd3d42: {void (void)} 0x7ffe78cd3d42 <wxAppConsoleBase::CallOnUnhandledException()>) at F:\code\wxWidgets-3.3.1\include\wx\private\safecall.h:40
No locals.
#9 0x00007ffe78d97c3d in wxSafeCall<wxThreadInternal::DoThreadStart(wxThread*)::<lambda()> >(const struct {...} &) (func=...) at F:\code\wxWidgets-3.3.1\include\wx\private\safecall.h:54
No locals.
#10 0x00007ffe78d93ac2 in wxThreadInternal::DoThreadStart (thread=0xa4b84d0) at F:\code\wxWidgets-3.3.1\src\msw\thread.cpp:514
wxScopeGuard510 = @0xb84fe20: {m_wasDismissed = false}
rc = 4294967295
#11 0x00007ffe78d93b6a in wxThreadInternal::WinThreadStart (param=0xa4b84d0) at F:\code\wxWidgets-3.3.1\src\msw\thread.cpp:559
rc = 4294967295
thread = 0xa4b84d0
hasExited = false
isDetached = false
#12 0x00007fff4f18af5a in msvcrt!_beginthreadex () from C:\WINDOWS\System32\msvcrt.dll
No symbol table info available.
#13 0x00007fff4f18b02c in msvcrt!_endthreadex () from C:\WINDOWS\System32\msvcrt.dll
No symbol table info available.
#14 0x00007fff4f097374 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\System32\kernel32.dll
No symbol table info available.
#15 0x00007fff4f43cc91 in ntdll!RtlUserThreadStart () from C:\WINDOWS\SYSTEM32\ntdll.dll
No symbol table info available.
#16 0x0000000000000000 in ?? ()
No symbol table info available.
@ ollydbg
Did this backtrace come from click cancel/stop when the assert applied, or at some other time?
I just build C::B against wx 3.3.1, and the result C::B report many error messages when I load a project, the message looks like below:Code[Window Title]
wxWidgets Debug Alert
[Main Instruction]
A debugging check in this application has failed.
[Content]
..\..\include/wx/recguard.h(36): assert "m_flag > 0" failed in ~wxRecursionGuard(): unbalanced wxRecursionGuards!?
[ ] Don't show this dialog again [Stop] [Continue]
Any ideas which cause this issue?
EDIT:
Here is the crash report from the RPT file:Codecodeblocks.exe caused a Breakpoint at location 00007FF94B7822BA in module wxmsw331u_gcc_custom.dll.
AddrPC Params
00007FF94B7822BA 00000260EFC92E70 0000000000000000 0000000000000000 wxmsw331u_gcc_custom.dll!wxEvtHandler::SearchDynamicEventTable+0x12a
00007FF94B7828FB 0000000000000001 00000260F4764260 0000009E3CBFF750 wxmsw331u_gcc_custom.dll!wxEvtHandler::TryHereOnly+0x2b
00007FF94B782983 00000260F4763FD0 0000009E3CBFF6F0 00000260F4764260 wxmsw331u_gcc_custom.dll!wxEvtHandler::ProcessEventLocally+0x33
00007FF94B782A61 0000000000011A38 0000000000000000 0000000000000000 wxmsw331u_gcc_custom.dll!wxEvtHandler::ProcessEvent+0xc1
00007FF94BA75018 0000009E3CBFF8E0 0000000000000001 00000260F4762440 wxmsw331u_gcc_custom.dll!wxWindowBase::TryAfter+0x58
00007FF94BA557DC 00007FF94C8F48E0 00007FF900000002 00000260F00FF3D0 wxmsw331u_gcc_custom.dll!wxToolBarBase::UpdateWindowUI+0x19c
00007FF94BA68217 0000000000000000 0000000000000000 0000000000000000 wxmsw331u_gcc_custom.dll!wxWindowBase::SendIdleEvents+0x17
00007FF94BA6824F 0000000000000000 0000000000000000 0000000000000000 wxmsw331u_gcc_custom.dll!wxWindowBase::SendIdleEvents+0x4f
00007FF94B969B04 00000260F4810D60 00000260F4810D60 0000000000000000 wxmsw331u_gcc_custom.dll!wxAppBase::ProcessIdle+0xc4
00007FF94B669CB3 0000000000000028 00007FF94C8C4150 0000009E3CBFFB40 wxmsw331u_gcc_custom.dll!wxEventLoopManual::DoRunLoop+0x83
00007FF94B669DC8 00000260EF70B960 00000260F4810D60 0000000000000000 wxmsw331u_gcc_custom.dll!wxEventLoopManual::DoRun+0x38
00007FF94B6698D8 0000000000000048 00007FF9BCFDC9D0 0000009E3CBFFAC0 wxmsw331u_gcc_custom.dll!wxEventLoopBase::Run+0x58
00007FF94B63619F 00000260EF75D0C0 00000260EF7128B0 00007FF94D0D95C8 wxmsw331u_gcc_custom.dll!wxAppConsoleBase::MainLoop+0x7f
00007FF62CCA62CA 00000260EF70B960 0000000000000000 0000000000000000 codeblocks.exe!0x62ca
00007FF94B6A879E FFFFFFFFFFFFFFFF 0000000000000008 0000000000000048 wxmsw331u_gcc_custom.dll!wxInitialize+0x12e
00007FF62CCA2A97 00007FF62CCA0000 0000000000000000 00000260EDC8365C codeblocks.exe!0x2a97
00007FF62CCA12E9 0000000000000000 0000000000000000 0000000000000000 codeblocks.exe!0x12e9
00007FF62CCA13D6 0000000000000000 0000000000000000 0000000000000000 codeblocks.exe!0x13d6
00007FF9BCFB7374 0000000000000000 0000000000000000 0000000000000000 KERNEL32.DLL!BaseThreadInitThunk+0x14
00007FF9BEBBCC91 0000000000000000 0000000000000000 0000000000000000 ntdll.dll!RtlUserThreadStart+0x21
Please explain this message from wxWidgets that occurs more and more with Codeblocks IDE.
wxWidgets Debug Alert
A debugging check in this application has failed.
..\..\include/wx/recguard.h(36): assert "m_flag > 0" failed in ~wxRecursionGuard(): unbalanced wxRecursionGuards!?
Gemini responded;
This specific error is a classic "housekeeping" alert from the wxWidgets library. In short, the program is telling you that it tried to clean up a safety mechanism, but the math didn't add up.
What is a Recursion Guard?
A wxRecursionGuard is a tool developers use to prevent a function from calling itself infinitely (which would crash the program). Think of it like a "Do Not Enter" sign that a function hangs on its door when it starts working. When the function finishes, it takes the sign down.
The error assert "m_flag > 0" failed means that when the function finished and went to take the sign down, it found the sign was already gone - or it found "negative" signs. This is what the message means by "unbalanced."
Why is this happening in Code::Blocks?
Code::Blocks is built using wxWidgets. You are seeing this more often likely due to one of three reasons:
UI Event Races: Code::Blocks is trying to process a UI event (like a mouse click or a window redraw) while another event is still finishing. This is common if you are clicking rapidly or if the IDE is lagging.
Plugin Conflicts: A specific plugin (like Code Completion or Symbol Browser) might be triggering a "re-entrant" call, where it starts a task, gets interrupted, and fails to clean up its state properly.
Build/Version Mismatch: If you recently updated your OS or the IDE, there might be a slight incompatibility in how messages are passed between the system and the wxWidgets layer.
How to Fix or Bypass It
Since this is a Debug Alert, it is technically a warning for the developers of Code::Blocks, not necessarily a sign that your code is broken.
The "Ignore" Method: Click "Yes" to continue (this usually ignores the specific failure) or "No" to stop debugging. If you click "Cancel," it will likely crash the IDE to trigger a debugger.
Update Code::Blocks: Check if there is a newer "Nightly Build" or stable release. These "unbalanced guard" bugs are frequently patched in newer revisions.
Disable Heavy Plugins: Go to Plugins -> Manage plugins and try disabling non-essential ones (like "SpellChecker" or "Occurrences Highlight") to see if the frequency drops.
The "Silent" Route: If it is driving you crazy, you can run the "non-debug" version of Code::Blocks (the release build), which typically strips out these assert checks so they don't pop up.
I see this issue again and again. Sometimes, the C::B just existed(crashed) without any message, this happens after when I click the "Cancel" button in the message box to continue the application. When I looked at the RPT(call stack), it just empty, so I don't have much information to share.