Bluehazzard found a crash when reviewing the patch for Ticket 654. I have been scratching my head with it and I have found and tested a bunch of different things and looked at other C::B code that uses the clipboard and have been able to reproduce the crash with the following:
C::B version: Nightly svn-r12829
Compiler: Latest MSYS2 Mingw64 & GDB
Steps to reproduce the crash:
1) Start the nightly C::B
2) Load a simple test app with a variable you can watch
3) Set a breakpoint on a line where you can add a watch of some variable
4) Run to the breakpoint
5) Right click on the variable and watch the variable
6) Click on the variable in the watch window
7) Step to the next line (F7)
8) Close the watch window
9) Close C::B windows via [X] on top right & press the [OK] to close project while debugging.
10) Check for rpt file in C:\Users\<username>\AppData\Roaming\CodeBlocks directory if running from program files otherwise the Codeblocks.exe directory</username>
Be aware that different combinations of steps 6 & 7 can cause the crash to not occur. There could be other combinations that also cause the crash to not occur.
Attached is the crash rpt for the nightly and the sample app I use.
I have seen the crash occurs on wxWidgets 3.1.5, 3.1.6 and 3.1.7, but do not have enough wxWidget knowledge to dig into the bug further.
Attached is the crash report when linked to wx 3.1.7 debug build.
Can you try this patch and look if it fixes it?
This fixes it.
How did you figure out this is where the issue is?
I do not think this fixes the "root" cause of the problem, only a symptom. Your second stack trace was really helpful.
I think the problem is that on shutdown all windows (in this case also the main frame where the debugger window is) get destroyed and then somehow the sub windows (i am not sure about this mechanism i will try to debug it better). The end result is that the destroyed WatchDlg tries to remove itself from the docking manager and then the docking manager tries to repaint the parent frame what was destroyed previously. With this patch i simply do not remove the watch dialog from the dockmanager when we shutdown codeblocks. It gets destroyed anyway...
I still would like to remove the root cause of this, or fix the order how windows get destroyed...
This code at main.cpp:3152 may be related
Sorry guys, but this I understand some of it. Some bits I am still learning.
If you want anything tested or checked or even code multiple code changes and testing or anything you can think of to help please let me know what you want me to do so I can try and help with getting this fixed as I am 1000% confident that I can only help with testing or supplying more info.
Is the code above compiled at all on your system?
Yes. I have no local changes between lines 1790 and 4485 of the SVN main.cpp, so the code is compiled in my testing.
Last edit: Andrew Cottrell 2022-06-15
I asked if it really compiles; write a syntax error inside the #if
I added crap "wes2323" inside the #if on new line and the build failed, so yes it compiled with MSYS2 Mingw64 GCC 12.1.0