User forums > Using Code::Blocks

bug report: C::B crash when I remove the target from a cbp

(1/4) > >>

ollydbg:
Steps to reproduce this crash:

1, open a cbp project which has some targets
2, open the cbp property dialog, and delete some targets.
3, press the OK button of the dialog
4, C::B crash

I'm using the latest rev 12977

The crash call-stack looks like below:

--- Code: ---codeblocks.exe caused an Access Violation at location 000007FEE82F9B4C in module libstdc++-6.dll Reading from location 00000000000009C6.

AddrPC           Params
000007FEE82F9B4C 0000000000000001 0000000000000026 00000000030DC910  libstdc++-6.dll!std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::basic_string+0xc
000007FEE5DFEA00 00000000002F6780 00000000000009BE 00000000002F6A60  codeblocks.dll!ConfigManager::GetUserDataFolder+0x6cc20
000007FEE5E29603 00000000002F6A30 00000000000009BE 0000000006D7DEE0  codeblocks.dll!cbThreadPool::Done+0xb043
000007FEE5B6B5B5 00000000065DE420 0000000006FE7260 0000000000000000  codeblocks.dll!MacrosManager::RecalcVars+0x107
000007FEE5B70134 00000000065DE420 00000000002F97C0 0000000006F0DE80  codeblocks.dll!MacrosManager::ReplaceMacros+0x420
000007FEE5B94FAA 0000000006D41F30 0000000006F0DE80 0000000006FE0560  codeblocks.dll!ProjectFile::CompareProjectFiles+0x45e
000007FEE5B94875 0000000006FE0560 0000000006F0DE80 00000000002FAC30  codeblocks.dll!ProjectFile::DoUpdateFileDetails+0xb5
000007FEE5B94795 0000000006FE0560 0000000000000000 0000000006FE7200  codeblocks.dll!ProjectFile::UpdateFileDetails+0xcf
000000013F150495 0000000006FE7260 0000000006FE7458 0000000000000050  codeblocks.exe!0xb0495
000000013F14566C 00000000028A7DC0 00000000002FB750 0000000000490F40  codeblocks.exe!0xa566c
000007FEE6122E77 00000000033EFFE0 0000000000000000 0000000000000000  wxmsw32u_gcc_cb.dll!wxAppConsoleBase::CallEventHandler+0xb7
000007FEE6272AA5 00000000032A9830 0000000000000000 0000000000000084  wxmsw32u_gcc_cb.dll!wxEvtHandler::ProcessEventIfMatchesId+0x85
000007FEE6272C8B 00000000028A7DC0 00000000002FB570 0000000000000000  wxmsw32u_gcc_cb.dll!wxEventHashTable::HandleEvent+0xfb
000007FEE62732CD 0000000000000111 0000000000000000 0000000000141598  wxmsw32u_gcc_cb.dll!wxEvtHandler::TryHereOnly+0x3d
000007FEE6272D73 0000000002369820 00000000002FB750 0000000000000000  wxmsw32u_gcc_cb.dll!wxEvtHandler::DoTryChain+0x43
000007FEE6273421 000000000308F3B0 00000000002FB750 00000000FFFFFFFF  wxmsw32u_gcc_cb.dll!wxEvtHandler::ProcessEvent+0xc1
000007FEE65957C8 000000000308F3B0 000007FEE6274EDB 0000000000000001  wxmsw32u_gcc_cb.dll!wxWindowBase::TryAfter+0x58
000007FEE65957C8 000007FEE6FADB80 00000000002FBEE0 00000000002FB750  wxmsw32u_gcc_cb.dll!wxWindowBase::TryAfter+0x58
000007FEE6274EDB 000000000308F3B0 000007FEE645C1E9 00000000002FBA08  wxmsw32u_gcc_cb.dll!wxEvtHandler::SafelyProcessEvent+0xb
000007FEE653C8AA 0000000000000070 FFFFFFFFFFFFFFFF FFFFFFFFFFFF0000  wxmsw32u_gcc_cb.dll!wxMenuBase::SendEvent+0xca
000007FEE63FFF9D 000000000014148A 000007FEFACE22F8 0000000000000084  wxmsw32u_gcc_cb.dll!wxMenu::MSWCommand+0x9d
000007FEE637A64B 0000000000000111 000007FFFFFDD000 0000000000000000  wxmsw32u_gcc_cb.dll!wxWindow::MSWHandleMessage+0x12cb
000007FEE6365EFC 0000000000000000 0000000000000038 00000000002FBBF8  wxmsw32u_gcc_cb.dll!wxWindow::MSWWindowProc+0x2c
0000000077609861 00000000002FBCE0 000007FEE636E420 00000000776095C0  USER32.dll!TranslateMessageEx+0x291
0000000077609572 00000000002FBCE0 00000000002FBCE0 000007FEE636E420  USER32.dll!TranslateMessage+0x1de
000007FEE6367E71 00000000004BE230 00000000002FE910 000000000308F3B0  wxmsw32u_gcc_cb.dll!wxWindow::DoPopupMenu+0xa1
000007FEE6590FC4 00000000002FBF98 00000000004BE230 000007FEE6DB6594  wxmsw32u_gcc_cb.dll!wxWindowBase::PopupMenu+0x44
000000013F19989C 000000000308F3B0 00000000002FBEE0 00000000002FE4F8  codeblocks.exe!0xf989c
000000013F13CC6B 00000000028A7DC0 00000000003E5CE0 00000000002FE4F8  codeblocks.exe!0x9cc6b
000000013F140DBB 00000000028A7DC0 00000000002FE910 0000000002050001  codeblocks.exe!0xa0dbb
000007FEE6122E77 0000000000141598 000000000000113E 0000000000000000  wxmsw32u_gcc_cb.dll!wxAppConsoleBase::CallEventHandler+0xb7
000007FEE6272AA5 0000000000001111 0000000000000000 00000000002FE890  wxmsw32u_gcc_cb.dll!wxEvtHandler::ProcessEventIfMatchesId+0x85
000007FEE6272C8B 00000000028A7DC0 0000000000001111 0000000000001111  wxmsw32u_gcc_cb.dll!wxEventHashTable::HandleEvent+0xfb
000007FEE62732CD 0000000000002803 0000000000002859 00000000000907DA  wxmsw32u_gcc_cb.dll!wxEvtHandler::TryHereOnly+0x3d
000007FEE6272D73 0000000002369820 00000000002FE910 0000000000000000  wxmsw32u_gcc_cb.dll!wxEvtHandler::DoTryChain+0x43
000007FEE6273421 000000000308F3B0 00000000002FE910 00000000002FE910  wxmsw32u_gcc_cb.dll!wxEvtHandler::ProcessEvent+0xc1
000007FEE65957C8 0000000000000014 00000000003E5CE0 0000000000000072  wxmsw32u_gcc_cb.dll!wxWindowBase::TryAfter+0x58
000007FEE65957C8 0000000000000000 000000000308F3B0 00000000002FF1B0  wxmsw32u_gcc_cb.dll!wxWindowBase::TryAfter+0x58
000007FEE6274EDB 000000000308F3B0 00000000002FF1B0 0000000000141598  wxmsw32u_gcc_cb.dll!wxEvtHandler::SafelyProcessEvent+0xb
000007FEE645D973 0000000000000000 0000000000141598 0000000000000000  wxmsw32u_gcc_cb.dll!wxTreeCtrl::MSWOnNotify+0x133
000007FEE6379D15 00000000009EB780 000000007787B4EF 0000000000000000  wxmsw32u_gcc_cb.dll!wxWindow::MSWHandleMessage+0x995
000007FEE6365EFC 0000000000141598 0000000000000001 0000000000000000  wxmsw32u_gcc_cb.dll!wxWindow::MSWWindowProc+0x2c
0000000077609861 00000000009EB780 000007FEE636E420 00000000FFFFFE0E  USER32.dll!TranslateMessageEx+0x291
000000007760674C 00000000000907DA 000000000000004E 00000000000002EC  USER32.dll!SetTimer+0x16c
0000000077606851 000000000308F3B0 00000000000002EC 000000000308F3B0  USER32.dll!SendMessageW+0x5d
000007FEE645C5E7 FFFFFFFFFFFFFFFF 0000000000000000 0000000000000000  wxmsw32u_gcc_cb.dll!wxTreeCtrl::MSWWindowProc+0x6d7
0000000077609861 00000000002FF6E0 000007FEE636E420 00000000009EB780  USER32.dll!TranslateMessageEx+0x291
0000000077609572 0000000000000000 0000000000000000 000007FEE636E420  USER32.dll!TranslateMessage+0x1de
000000007760646E 0000000002369820 000007FEE6CF8EB0 00000000002FF6E0  USER32.dll!IsDialogMessageW+0x102
000007FEE6369330 0000000006E2B690 000007FEE63B8C64 0000000006BF5610  wxmsw32u_gcc_cb.dll!wxWindow::MSWSafeIsDialogMessage+0xd0
000007FEE63695D9 000000000308F3B0 0000000000000001 0000000000000000  wxmsw32u_gcc_cb.dll!wxWindow::MSWProcessMessage+0x79
000007FEE639A4A0 00000000002FF720 000007FEE6589930 0000000000000000  wxmsw32u_gcc_cb.dll!wxGUIEventLoop::PreProcessMessage+0x110
000007FEE639A7EF 0000000006ECAF30 0000000000010000 0000000006ECAF30  wxmsw32u_gcc_cb.dll!wxGUIEventLoop::Dispatch+0x13f
000007FEE61547E3 0000000000000002 0000000000000040 0000000000000000  wxmsw32u_gcc_cb.dll!wxEventLoopManual::ProcessEvents+0x33
000007FEE61548F8 00000000004BE230 0000000006ECAF30 0000000000000000  wxmsw32u_gcc_cb.dll!wxEventLoopManual::DoRun+0xf8
000007FEE61545C8 0000000000000008 0000000006ECAF30 00000000004BDA30  wxmsw32u_gcc_cb.dll!wxEventLoopBase::Run+0x58
000007FEE6126040 0000000000000030 000007FEE71C7B40 0000000000000000  wxmsw32u_gcc_cb.dll!wxAppConsoleBase::MainLoop+0x70
000000013F0A5E56 00000000004BE230 000007FEE627F9FF 00000000004BDA40  codeblocks.exe!0x5e56
000007FEE6198EF1 00000000004BDA30 000000000000000C 00000000004BDA40  wxmsw32u_gcc_cb.dll!wxEntryReal+0x51
000000013F0A2585 000000013F0A0000 0000000000000000 000000000032323C  codeblocks.exe!0x2585
000000013F0A13AE 0000000000000000 0000000000000000 0000000000000000  codeblocks.exe!0x13ae
000000013F0A14C6 0000000000000000 0000000000000000 0000000000000000  codeblocks.exe!0x14c6
000000007770556D 0000000000000000 0000000000000000 0000000000000000  kernel32.dll!BaseThreadInitThunk+0xd
000000007786372D 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!RtlUserThreadStart+0x1d

--- End code ---

I also upload the gif file of the operation.

Thanks.

AndrewCot:
I just loaded a copy of my CodeBlocks_Windows.cbp and deleted a few targets and did not get the crash. I closed C::B and reloaded the cbp file and deleted some more targets and it did not crash. I am using SVN 12979 (same code as 129879 , but with updated SVG files) built with MSYS2 Mingw64 GCC 12.2 (last updated about 6 hrs ago).

I then tried with the nightly 12969 and did not get a crash. I tried with both the latest MSYS2 MinGW64 libstdc++-6.dll and the nightly official DLL from 2018 and still did not get a crash.
Can you try the nightly 12969and see if it crashes?


ollydbg:
Hi, AndrewCot, thanks for the test. I will try the official nightly build.

My guess is that I have some macro(global compiler variable) in the cbp, for example:


--- Code: ---<Add option="`$(#WX_CONFIG) --cflags`" />
--- End code ---

Do you have such kinds of macros in the cbp?

AndrewCot:
I have a bunch of macros, but this one does not have the wx-config macro. Attached is the original project file before I did any testing.

I just tested with my old (as in I have not touched it in a month ) MSSY2 proejct file that uses  wx-config macro and it does not crash with 12979. I have also attached it.

Pecan:
I see that just before the crash ConfigManager::GetUserDataFolder() was called.
But I don't see (in the crash report) from where it was called.
It can only be called from

--- Code: ---void ConfigManager::InitPaths()
{
    ConfigManager::config_folder = ConfigManager::GetUserDataFolder();

--- End code ---
or

--- Code: ---wxString CfgMgrBldr::FindConfigFile(const wxString& filename)
{

    wxString u(ConfigManager::GetUserDataFolder() + wxFILE_SEP_PATH + filename);

--- End code ---

GetUserDataFolder() does some weird things.

--- Code: ---inline wxString ConfigManager::GetUserDataFolder()
{
    if (has_alternate_user_data_path)
        return alternate_user_data_path;
#ifdef __WINDOWS__
    TCHAR buffer[MAX_PATH];
    if (!ConfigManager::has_alternate_user_data_path && ::GetEnvironmentVariable(_T("APPDATA"), buffer, MAX_PATH))
        return wxString::Format(_T("%s\\CodeBlocks"), buffer);
    else
        return wxStandardPathsBase::Get().GetUserDataDir();
#else
#ifdef __linux__
    gchar *filename = g_build_filename(g_get_user_config_dir(), "codeblocks", nullptr);
    wxString result=wxString::FromUTF8(filename);
    g_free(filename);
    return result;
#else
    return wxStandardPathsBase::Get().GetUserDataDir();
#endif // __linux__
#endif // __WINDOWS__
}

--- End code ---

It calls:

--- Code: ---if (!ConfigManager::has_alternate_user_data_path && ::GetEnvironmentVariable(_T("APPDATA"), buffer, MAX_PATH))

--- End code ---

Where GetEnvironmentVariable() is declared as (in my system)

--- Code: --- __MINGW_NAME_AW(GetEnvironmentVariable)
  WINBASEAPI DWORD WINAPI GetEnvironmentVariableA (LPCSTR lpName, LPSTR lpBuffer, DWORD nSize);
  WINBASEAPI DWORD WINAPI GetEnvironmentVariableW (LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize);

#define GetEnvironmentVariable

--- End code ---
in msys64_13.0.1\mingw64\include\processenv.h
where it crashed in libstdc++-6.dll;

What in the world is it doing.
Or might there be some mixed up system dll's in your system. (Just trying a guess)

Maybe try a full build and see if the problem goes away.

Navigation

[0] Message Index

[#] Next page

Go to full version