Author Topic: Code::Blocks (sometimes) crashes while closing.  (Read 5759 times)

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Code::Blocks (sometimes) crashes while closing.
« on: January 06, 2006, 08:34:09 pm »
I'm using Code::Blocks Version 1.0 revision 1662 (gcc 3.4.4 Linux/unicode, build: Jan 6 2006 19:33:53) with wxGTK-2.6.2 and stumbled over a rather weired crash today.
If I start Code::Blocks and modify my default layout (for example resizing the window with the project tree or something like this) and the close Code::Blocks it will ask me if I want to save my changes to the default layout. It doesn't matter if I save it or not, Code::Blocks shuts down as it should and the changes are stored correctly (if I demanded Code::Blocks to save them). But if I don't modify my layout Code::Blocks produces a segmentation fault while shutting down. (It doesn't matter if a project was open - the behaviour is exactly the same as without one.)
Here is the output from gdb:
Code
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 17056)]
0xb788a370 in wxGenericTreeCtrl::CalculateSize ()
   from /usr/lib/libwx_gtk2u_core-2.6.so.0

(gdb) bt
#0  0xb788a370 in wxGenericTreeCtrl::CalculateSize ()
   from /usr/lib/libwx_gtk2u_core-2.6.so.0
#1  0xb78904ac in wxGenericTreeCtrl::CalculateLevel ()
   from /usr/lib/libwx_gtk2u_core-2.6.so.0
#2  0xb78907a6 in wxGenericTreeCtrl::CalculatePositions ()
   from /usr/lib/libwx_gtk2u_core-2.6.so.0
#3  0xb7891473 in wxGenericTreeCtrl::OnInternalIdle ()
   from /usr/lib/libwx_gtk2u_core-2.6.so.0
#4  0xb77d11b6 in wxAppBase::SendIdleEvents ()
   from /usr/lib/libwx_gtk2u_core-2.6.so.0
#5  0xb77d11e6 in wxAppBase::SendIdleEvents ()
   from /usr/lib/libwx_gtk2u_core-2.6.so.0
#6  0xb77d11e6 in wxAppBase::SendIdleEvents ()
   from /usr/lib/libwx_gtk2u_core-2.6.so.0
#7  0xb77d10fc in wxAppBase::ProcessIdle ()
   from /usr/lib/libwx_gtk2u_core-2.6.so.0
#8  0xb7727215 in wxPaletteBase::GetColoursCount ()
   from /usr/lib/libwx_gtk2u_core-2.6.so.0
#9  0xb6e30d18 in g_idle_remove_by_data () from /usr/lib/libglib-2.0.so.0
#10 0xb6e30efc in g_idle_remove_by_data () from /usr/lib/libglib-2.0.so.0
#11 0xb6e31868 in g_idle_remove_by_data () from /usr/lib/libglib-2.0.so.0
#12 0xb6e2d5a5 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#13 0xb70a26cb in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#14 0xb7744126 in wxEventLoop::Run () from /usr/lib/libwx_gtk2u_core-2.6.so.0
#15 0xb77d0e29 in wxAppBase::MainLoop () from /usr/lib/libwx_gtk2u_core-2.6.so.0
#16 0xb77d0f66 in wxAppBase::OnRun () from /usr/lib/libwx_gtk2u_core-2.6.so.0
#17 0x080601c8 in CodeBlocksApp::OnRun (this=0x3) at app.cpp:452
#18 0xb753d07a in wxEntry () from /usr/lib/libwx_baseu-2.6.so.0
#19 0xb753d3ee in wxEntry () from /usr/lib/libwx_baseu-2.6.so.0
#20 0x0805f64a in main (argc=1, argv=0x3) at app.cpp:86
The value in the first line differs sometimes but the crash always happens in wxGenericTreeCtrl::CalculateSize.
The strange thing is: No Code::Blocks-code seems to be (directly) involved in the crash.

The crash did not appear with my previous version (I think it was revision 1648). To make it even more complicated: Code::Blocks is not the only thing that changed. Today I did an update of glib (new version: 2.8.4) and gtk+ (new version: 2.8.8 ) - both compiled with gcc 3.3.6 while wxGTK and Code::Blocks are compiled with gcc 3.4.4. Thus I first thought about a problem with that libraries and did an update from wxGTK up to version 2.6.2 (compiled with gcc 3.4.4 - I had to do this update for another reason (incompatibility from wxGTK 2.6.1 with the new gtk-version), too) and even recompiled gtk+ with gcc 3.4.4. But nothing changed. Then I did a few test within Code::Blocks and discovered the behaviour described at the top of this post. As the crash does not appear in every situation (but can be reproduced, at least on my machine) I have no idea whether this is a bug in Code::Blocks (it could be although no code from Code::Blocks is directly involved in the crash - possible due to a wrong parameter in a wxWidgets-related function or some other malpractice that causes problems) or if it is just a problem with my system (which is indeed not really consistent as parts of it are compiled with gcc 3.3 while other parts are compiled with gcc 3.4).
And because of this, here is my question: Has anyone an idea what the reason for this problem is or can anyone reproduce this crash?
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline klight

  • Multiple posting newcomer
  • *
  • Posts: 24
Re: Code::Blocks (sometimes) crashes while closing.
« Reply #1 on: January 06, 2006, 09:07:45 pm »
I've noticed this somewhere in the late 1640's or early 1650's svn's.  Mine happend on a WinXP machine.  It first caught me by surprise because I had exited C::B and was trying to start it back up and the dialog about running multiple instances showed up.  Nothing about C::B was visble on the task bar or when I <ctrl>-<tab>, but after a <ctrl>-<alt>-<del> there was a CodeBlocks process in the Processes list. 

It doesn't happen often.  I can only remember it one other time.

I'll try to pay more attention next time and perhaps Dr.MinGW will help  :?

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Code::Blocks (sometimes) crashes while closing.
« Reply #2 on: January 06, 2006, 09:51:26 pm »
I have compiled Code::Blocks under Linux only 3 times, and 1 under FreeBSD. The first compilation, that was a long time ago (the project was still on CVS), always crashed on exit, like a last millisecond crash before it could finish exiting. A few days ago I compiled Code::Blocks again but didn't test it that much, even though I don't remember it crashing. Compiled a more recent version and the crashing is back.

The FreeBSD one, on the other hand, was the same version as the first I compiled for Linux, and it didn't crash.

Sometimes those crashes are caused by a plugin, so I'd recommend to disable all the plugins and quit Code::Blocks. Open it again, close it. Did it crash? If it didn't, open it, enable a plugin. Close it. Open it again and close it. Did it crash? If it didn't, open it, enable another plugin. Close it. And so on.

If you find it crashes when you enable a specific plugin, try the same with only that plugin enabled. If it keeps crashing with just that plugin then we got something.

I'd test it myself but right now I must go.

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Code::Blocks (sometimes) crashes while closing.
« Reply #3 on: January 06, 2006, 10:54:24 pm »
The first compilation, that was a long time ago (the project was still on CVS), always crashed on exit, like a last millisecond crash before it could finish exiting.
Yes, I had those problems, too, but this was even before RC2 if I remember correctly.

Anyway, I tried removing all plugins and things got even more weired. After doing so Code::Blocks asked me if I want to save my layout every time I tried to close Code::Blocks even if I didn't change anything. But, as described before, if Code::Blocks asks me it does not crash.
Then I tried adding more and more plugins. It worked for the first two oder three I tried (Well, Code::Blocks asked me all the time if it should save the layout although it never changed) but as I added the compiler-plugin Code::Blocks stopped asking and started crashing.
To make it even more complicated: I removed all plugins again. Now Code::Blocks doesn't ask me if the layout should be saved if I didn't change it - but (what a sursprise) it crashes.

Thus, I don't think a plugin is causing these problems. Either it is a problem with the core part of Code::Blocks or a problem with my system. Would be nice if you could check if the crash that happens on your machine is the same as the one I'm dealing with...

PS: Is it correct that the config-file does not contain newlines anymore? I noticed that because I directly edited the config-file to remove the plugins as Code::Blocks does not save the current configuration before the crash.
« Last Edit: January 06, 2006, 10:55:59 pm by Der Meister »
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Code::Blocks (sometimes) crashes while closing.
« Reply #4 on: January 06, 2006, 11:01:16 pm »
with todays commits, the config file has newlines again.

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Code::Blocks (sometimes) crashes while closing.
« Reply #5 on: January 06, 2006, 11:16:06 pm »
Thanks, I didn't notice that change. With revision 1665 the config-file looks nice again. However, Code::Blocks keeps crashing.
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Code::Blocks (sometimes) crashes while closing.
« Reply #6 on: January 06, 2006, 11:23:32 pm »
I had 2-3 odd crashes after wxAUI was merged, but was unable to reproduce it since then.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: Code::Blocks (sometimes) crashes while closing.
« Reply #7 on: January 06, 2006, 11:34:33 pm »
Well, I think I'll build revision 1648 again. If that crashes, too, it is definitely a problem with my own system.

Edit: OK, it crashes, too, although the backtrace brings different results. The problem here seems to be that my libc and glib are compiled with gcc 3.3 but gtk with 3.4 - and these two gcc-versions are binary incompatible.
I'll try to get revision 1648 working again tomorrow. Let's hope that this will also solve the problem with the current version.
« Last Edit: January 07, 2006, 12:05:34 am by Der Meister »
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.