Bug #13447 2008-03-24 23:35

fozzybear

Code::Blocks crashes on wxSmith use

I work on a 64-bit Pentium HT machine with Kubuntu Gutsy.

The version of C::B is the new release: 8.02 (feb 27 2008, 23:38:00 wx2.8.7 Linux/unicode) but it happens on all versions, even self-built ones.

Every time I work some time with wxSmith and save the wxs a few times the application starts to crash when I double click or open the wxs. I checked the wxs file but saw nothing strange.

Sometimes it helps to open the wxs on my 32-bit machine and only change it there. That machine has the same config. But the wxs can never be opened on the 64-bit machine again.

I don't know if it's bit-related or something else. I've read through the whole forum and bugs but couldn't find the same problem there.

When I start C::B in the console it spits out complaints about memory and wxsmith and sums up every lib it's using before crashing.

*** glibc detected *** codeblocks: malloc(): memory corruption: 0x0000000001dfc140 ***

It's reproducible and every version of C::B had this problem on my machine. I save my work with SVN on my 32-bit machine, don't know if that's a cause but it shouldn't be.

I would really like to see this fixed because I love C::B and wxWidgets.

Need any more info, please mail me...

Category
Plugin::wxSmith
Group
 
Status
Closed
Close date
2008-07-11 15:11
Assigned to
mortenmacfly
biplab 2008-03-26 16:11

Please set the following environment variable G_SLICE as before launching Code::Blocks-

export G_SLICE=always-malloc

This should solve your problem.

fozzybear 2008-03-28 00:03

Thanks for your reply but export G_SLICE=always-malloc did not fix the problem. I did set this in Settings > Environment > environment settings and also tried it from the console but it makes no difference. I looked up glibc and G_SLICE=always-malloc and it seems more applications in Linux suffer from memory leakage like problems. Is this a glibc problem and not a wxSmith problem?

fozzybear 2008-03-30 01:12

I've just found out it's possibly a privileges problem. Why didn't I think of this earlier! If I simply do sudo codeblocks I can open my wxs in wxSmith without crashing and use the preview button which caused crashing also. I'm very happy, I can work again!

But seriously, Code::Blocks should work without root privileges, right?

ID_46368 2008-06-12 20:32

I have the same problem, and

export G_SLICE=always-malloc

doesn't help. Running C::B as root doesn't help also.

My systems - mandriva 2008.1/x86_64 and mandriva 2009.0 (unstable development)/x86_64 on two different hardware configs (Athlon 64 & Core 2 Duo).

Tested versions of C::B - 8.02 and svn5093

Steps to reproduce the bug:

1. Start C::B and create new wxWidgets dialog-based project with wxSmith and all default settings.

2. Open its dialog and remove all controls and sizers (including root wxBoxSizer:BoxSizer1) - it should become just an empty square form with dotted grid.

3. Add wxSpinCtrl (without any sizers). It occupies the whole form (strange... another bug?).

4. Add another wxSpinCtrl - just put it over the firts one. Both controls become of the normal size and you can drag them to place correctly.

5. Save all files and close C::B.

6. Reopen C::B, load this project and try to open our dialog with two wxSpinCtrl controls for editing. C::B crashes. You will never be able to open this dialog again - only on 32-bit system (maybe)...

BTW I've tried to use other controls (not everyone), but they seem to work correctly - no crashes after reopening dialog for editing.

fozzybear 2008-06-12 21:03

After my initial cheerful announcement that running Code::Blocks as root solved the wxSmith crash I sadly have to say the problem came back although less frequently.

Nevertheless, when a form has crashed it can't be recovered so I resorted to setting up forms in wxSmith and then editing them manually. I'm glad to see another user reported the problem.

I hope something can be done about it because I still love wxSmith, especially because it's the only good free alternative.

ID_46368 2008-07-09 13:31

I have found the problem!

wxSmith crashes on forms loading due to the stupid bug: in some components their numeric properties are declared as 'int' while they are saved in file (and reading from file) as 'long'. On Linux/x86_64 this types interchanging causes memory overflow as sizeof(int)=4 while sizeof(long)=8.

To fix this you should go to the directory

<root_cb_sources>/src/plugins/contrib/wxSmith/wxwidgets/defitems , check all properties of all components - how they are declared and which macro (WXS_LONG or some other) is used to manipulate them - and fix if needed. Especially this is the case for spin button & spin control, but maybe also for some other widgets.

Good luck!

fozzybear 2008-07-09 14:40

I think olelukoie struck gold. Because I use both 32 and 64-bit systems with SVN in between, I think my code gets sort of "infected" with this long/int difference after which I can't use it any more on both systems.

I'm going to try and reproduce this by only using wxSmith on my 32-bit machine and see what happens.

(I'm silently hoping this cures it and it'll be fixed in the next Ubuntu release).

jenslody 2008-07-09 15:54

I just submitted a patch (#2516).

mortenmacfly 2008-07-11 15:11

Fixed by applying patch patch #2516, thanks!