eranif / codelite

A multi purpose IDE specialized in C/C++/Rust/Python/PHP and Node.js. Written in C++
https://codelite.org
GNU General Public License v2.0
2.13k stars 455 forks source link

[Bug]: CodeLite crashes right after Welcome Screen, or each time it is closed #3323

Closed yunkot closed 6 months ago

yunkot commented 6 months ago

What happened?

When running CodeLite on Windows 7, right after welcome screen, it crashes. Similarly, each time you close CodeLite, it crashes. The same happens with CodeLite built from sources. While doing so, it doesn't seem to remember "dark theme" settings - likely it crashes before these settings are saved.

If I delete CodeLite configuration files completely (those from \AppData\Roaming\codelite), it starts with a Welcome Screen and after going through steps of Welcome Screen, it crashes. Alternatively, if I just close the Welcome Screen, it runs in "white" style, but still crashes when I try to close it. Switching to "dark style" this way (without Welcome Screen) doesn't work.

Also, it does not seem to find mingw compiler anymore - this also applies to CodeLite when running on Windows 11. Previous version (CodeLite 14) could find it successfully: I have mingw-w64 binaries at: c:\mingw\x32\mingw32\bin. For previous versions of CodeLite, as long as I've used "mingw" base folder, CodeLite could find the binaries. Not sure if this issue is related.

Version

Installer for version 18.0 dated March 5, 2024, or built from sources, commit 3f4462b5edcfbe3dc9f561e25a63125ef522d1cc

Operating system

Windows 7 SP1 64-bit, fully patched, without internet connection (running inside VM)

Relevant log output

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: codelite.exe
  Application Version:  18.0.0.0
  Application Timestamp:    65e73d6d
  Fault Module Name:    wxmsw330u_clang_custom.dll
  Fault Module Version: 3.3.0.0
  Fault Module Timestamp:   65e56d52
  Exception Code:   c0000005
  Exception Offset: 0000000000512a22
  OS Version:   6.1.7601.2.1.0.768.3
  Locale ID:    1033
  Additional Information 1: 837c
  Additional Information 2: 837ce5d8f1486aa5f74798d7a30ff920
  Additional Information 3: d7b1
  Additional Information 4: d7b1546043d5c2a52602b890aca20c3b
eranif commented 6 months ago

Can you run CodeLite under lldb and post backtrace?

yunkot commented 6 months ago

"msys2" doesn't support Windows 7 and lldb from mingw-w64 package doesn't want to run codelite. Trying to debug with "gdb" results in "unrecognized executable".

However, using procdump, I could get two dumps, which in Windbg show the following:

[0x0]   ntdll!NtWaitForMultipleObjects+0xa   0x1dde18   0x7fefd651430   
[0x1]   KERNELBASE!WaitForMultipleObjectsEx+0xe8   0x1dde20   0x775516e3   
[0x2]   kernel32!WaitForMultipleObjectsExImplementation+0xb3   0x1ddf20   0x775cb8b5   
[0x3]   kernel32!WerpReportFaultInternal+0x215   0x1ddfb0   0x775cba37   
[0x4]   kernel32!WerpReportFault+0x77   0x1de050   0x775cba8f   
[0x5]   kernel32!BasepReportFault+0x1f   0x1de080   0x775cbcac   
[0x6]   kernel32!UnhandledExceptionFilter+0x1fc   0x1de0b0   0x777d0108   
[0x7]   ntdll! ?? ::FNODOBFM::`string'+0x2025   0x1de190   0x77767958   
[0x8]   ntdll!_C_specific_handler+0x8c   0x1de1c0   0x7777812d   
[0x9]   ntdll!RtlpExecuteHandlerForException+0xd   0x1de230   0x7776855f   
[0xa]   ntdll!RtlDispatchException+0x45a   0x1de260   0x7779bcb8   
[0xb]   ntdll!KiUserExceptionDispatch+0x2e   0x1de940   0x7feefcc29c2   
[0xc]   wxmsw330u_clang_custom!ZN18wxAuiMSWToolBarArtC2Ev+0x62   0x1df040   0x7feefcab9f6   
[0xd]   wxmsw330u_clang_custom!ZN12wxAuiToolBar4InitEv+0xd6   0x1df0a0   0x7fece253885   
[0xe]   libplugin!ZN13clSideBarCtrl7RealizeEv+0xf15   0x1df0f0   0x7fece250ec2   
[0xf]   libplugin!ZN13clSideBarCtrl12PlaceButtonsEv+0x202   0x1df190   0x7fece252931   
[0x10]   libplugin!ZN13clSideBarCtrl17SetButtonPositionE11wxDirection+0x21   0x1df2b0   0x14008677c   
[0x11]   codelite_exe + 0xb677c!codelite_exe+0xb677c   0x1df2f0   0x7feef7ba6b3   
[0x12]   wxmsw330u_clang_custom!ZNK16wxAppConsoleBase16CallEventHandlerEP12wxEvtHandlerR14wxEventFunctorR7wxEvent+0x53   0x1df380   0x7feef8a0586   
[0x13]   wxmsw330u_clang_custom!ZN12wxEvtHandler23SearchDynamicEventTableER7wxEvent+0xd6   0x1df3f0   0x7feef8a0308   
[0x14]   wxmsw330u_clang_custom!ZN12wxEvtHandler19ProcessEventLocallyER7wxEvent+0x38   0x1df450   0x7feef8a01e4   
[0x15]   wxmsw330u_clang_custom!ZN12wxEvtHandler12ProcessEventER7wxEvent+0x24   0x1df4a0   0x7fec57eb35e   
[0x16]   codelite!ZN13EventNotifier12ProcessEventER7wxEvent+0x1e   0x1df4e0   0x7feef8a001a   
[0x17]   wxmsw330u_clang_custom!ZN12wxEvtHandler20ProcessPendingEventsEv+0x11a   0x1df520   0x7feef7ba483   
[0x18]   wxmsw330u_clang_custom!ZN16wxAppConsoleBase20ProcessPendingEventsEv+0x73   0x1df580   0x7feef7ec32c   
[0x19]   wxmsw330u_clang_custom!ZN17wxEventLoopManual5DoRunEv+0x6c   0x1df5d0   0x7feef7ec056   
[0x1a]   wxmsw330u_clang_custom!ZN15wxEventLoopBase3RunEv+0x56   0x1df610   0x7feef7b9d3b   
[0x1b]   wxmsw330u_clang_custom!ZN16wxAppConsoleBase8MainLoopEv+0x7b   0x1df660   0x7feef8298c8   
[0x1c]   wxmsw330u_clang_custom!Z14wxAddEntryHookPFivE+0x338   0x1df6b0   0x1400b55ea   
[0x1d]   codelite_exe + 0xe55ea!codelite_exe+0xe55ea   0x1df710   0x1405defe8   
[0x1e]   codelite_exe + 0x60efe8!codelite_exe+0x60efe8   0x1df760   0x13ffd1315   
[0x1f]   codelite_exe + 0x1315!codelite_exe+0x1315   0x1df810   0x13ffd1156   
[0x20]   codelite_exe + 0x1156!codelite_exe+0x1156   0x1df860   0x775459cd   
[0x21]   kernel32!BaseThreadInitThunk+0xd   0x1df890   0x7777a561   
[0x22]   ntdll!RtlUserThreadStart+0x1d   0x1df8c0   0x0   

and this:

[0x0]   ntdll!NtWaitForMultipleObjects+0xa   0x1dde18   0x7fefd651430   
[0x1]   KERNELBASE!WaitForMultipleObjectsEx+0xe8   0x1dde20   0x775516e3   
[0x2]   kernel32!WaitForMultipleObjectsExImplementation+0xb3   0x1ddf20   0x775cb8b5   
[0x3]   kernel32!WerpReportFaultInternal+0x215   0x1ddfb0   0x775cba37   
[0x4]   kernel32!WerpReportFault+0x77   0x1de050   0x775cba8f   
[0x5]   kernel32!BasepReportFault+0x1f   0x1de080   0x775cbcac   
[0x6]   kernel32!UnhandledExceptionFilter+0x1fc   0x1de0b0   0x777d0108   
[0x7]   ntdll! ?? ::FNODOBFM::`string'+0x2025   0x1de190   0x77767958   
[0x8]   ntdll!_C_specific_handler+0x8c   0x1de1c0   0x7777812d   
[0x9]   ntdll!RtlpExecuteHandlerForException+0xd   0x1de230   0x7776855f   
[0xa]   ntdll!RtlDispatchException+0x45a   0x1de260   0x7779bcb8   
[0xb]   ntdll!KiUserExceptionDispatch+0x2e   0x1de940   0x7feefcc29c2   
[0xc]   wxmsw330u_clang_custom!ZN18wxAuiMSWToolBarArtC2Ev+0x62   0x1df040   0x7feefcab9f6   
[0xd]   wxmsw330u_clang_custom!ZN12wxAuiToolBar4InitEv+0xd6   0x1df0a0   0x7fece253885   
[0xe]   libplugin!ZN13clSideBarCtrl7RealizeEv+0xf15   0x1df0f0   0x7fece250ec2   
[0xf]   libplugin!ZN13clSideBarCtrl12PlaceButtonsEv+0x202   0x1df190   0x7fece252931   
[0x10]   libplugin!ZN13clSideBarCtrl17SetButtonPositionE11wxDirection+0x21   0x1df2b0   0x14008677c   
[0x11]   codelite_exe + 0xb677c!codelite_exe+0xb677c   0x1df2f0   0x7feef7ba6b3   
[0x12]   wxmsw330u_clang_custom!ZNK16wxAppConsoleBase16CallEventHandlerEP12wxEvtHandlerR14wxEventFunctorR7wxEvent+0x53   0x1df380   0x7feef8a0586   
[0x13]   wxmsw330u_clang_custom!ZN12wxEvtHandler23SearchDynamicEventTableER7wxEvent+0xd6   0x1df3f0   0x7feef8a0308   
[0x14]   wxmsw330u_clang_custom!ZN12wxEvtHandler19ProcessEventLocallyER7wxEvent+0x38   0x1df450   0x7feef8a01e4   
[0x15]   wxmsw330u_clang_custom!ZN12wxEvtHandler12ProcessEventER7wxEvent+0x24   0x1df4a0   0x7fec57eb35e   
[0x16]   codelite!ZN13EventNotifier12ProcessEventER7wxEvent+0x1e   0x1df4e0   0x7feef8a001a   
[0x17]   wxmsw330u_clang_custom!ZN12wxEvtHandler20ProcessPendingEventsEv+0x11a   0x1df520   0x7feef7ba483   
[0x18]   wxmsw330u_clang_custom!ZN16wxAppConsoleBase20ProcessPendingEventsEv+0x73   0x1df580   0x7feef7ec32c   
[0x19]   wxmsw330u_clang_custom!ZN17wxEventLoopManual5DoRunEv+0x6c   0x1df5d0   0x7feef7ec056   
[0x1a]   wxmsw330u_clang_custom!ZN15wxEventLoopBase3RunEv+0x56   0x1df610   0x7feef7b9d3b   
[0x1b]   wxmsw330u_clang_custom!ZN16wxAppConsoleBase8MainLoopEv+0x7b   0x1df660   0x7feef8298c8   
[0x1c]   wxmsw330u_clang_custom!Z14wxAddEntryHookPFivE+0x338   0x1df6b0   0x1400b55ea   
[0x1d]   codelite_exe + 0xe55ea!codelite_exe+0xe55ea   0x1df710   0x1405defe8   
[0x1e]   codelite_exe + 0x60efe8!codelite_exe+0x60efe8   0x1df760   0x13ffd1315   
[0x1f]   codelite_exe + 0x1315!codelite_exe+0x1315   0x1df810   0x13ffd1156   
[0x20]   codelite_exe + 0x1156!codelite_exe+0x1156   0x1df860   0x775459cd   
[0x21]   kernel32!BaseThreadInitThunk+0xd   0x1df890   0x7777a561   
[0x22]   ntdll!RtlUserThreadStart+0x1d   0x1df8c0   0x0   
eranif commented 6 months ago

To be clear here: The crash happens on Windows 7 The "unable to detect MinGW compiler" - for both Windows 11 & 7 Right?

eranif commented 6 months ago

These backtraces don't make sense. Both has these lines:

[0xd]   wxmsw330u_clang_custom!ZN12wxAuiToolBar4InitEv+0xd6   0x1df0a0   0x7fece253885   
[0xe]   libplugin!ZN13clSideBarCtrl7RealizeEv+0xf15   0x1df0f0   0x7fece250ec2   
[0xf]   libplugin!ZN13clSideBarCtrl12PlaceButtonsEv+0x202   0x1df190   0x7fece252931  

i.e.:

clSideBarCtrl::PlaceButtonsE() -> clSideBarCtrl::Realize() -> wxAuiToolBar::Init

However, PlaceButtons does not call clSideBarCtrl::Realize() (according to the code)

yunkot commented 6 months ago

"unable to detect MinGW compiler" does affect newer Windows 10+. Should I create a separate issue for it?

As for the crash, it only affects Windows 7. Previous version CodeLite 17.8.0 doesn't crash. Is there anything I else can do to help debug this problem?

Edit: CodeLite 17.8.0 doesn't crash, but choosing "dark" theme has no effect - it appears in "white" theme.

eranif commented 6 months ago

The crash is related to wxAuiToolBar used by clSidebarCtrl. I could try and replace it with wxToolBar (native toolbar) for Windows and see if it works. It will be a shot in the dark

yunkot commented 6 months ago

Thanks and if you want, I could try some patch to see if it resolves the problem, now that I'm able to build CodeLite on Windows.

Also, using some trial and error: CodeLite 16.4 was the last version to successfully detect installed version of "mingw-w64". CodeLite 16.7 was the last version, where dark theme works under Windows 7.

eranif commented 6 months ago

I have committed a change to use the native toolbar on Windows, please give it a try

yunkot commented 6 months ago

The aforementioned changes seem to resolve the crash, many thanks!

Should I create separate reports for the problems of non-working black theme and not detecting mingw-w64 installations?

eranif commented 6 months ago

Yes