Random crashes... How to solve?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
KaReL
Experienced Solver
Experienced Solver
Posts: 78
Joined: Mon Aug 30, 2004 8:52 am
Contact:

Random crashes... How to solve?

Post by KaReL »

Hi,

I just created a small application... But lately it began to crash like hell...

The problem is that one time it runs like a charm, no problems at all... All seems fine... Then I don't change anything, I just re-run it and during the same actions it crashes.

Now besides the fact that this is enormously frustrating, how can I find this error? (btw if I 'step' through the source, it never happens).

Thx
wxWidgets: SVN/trunk
OS: WinXP/2 + Ubuntu + Mac 10.4.11
Compiler: VS2005 + GCC 4.2 + GCC 4.0.1
-----
home: http://www.salvania.be
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

Do you use some kind of CVS system ? I would suggest go back to the part where it didn't crashed at all, and verify your changes.

Bugs like this are very vague. Usually one minor thing or unitialised variable is what causing this ...

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
KaReL
Experienced Solver
Experienced Solver
Posts: 78
Joined: Mon Aug 30, 2004 8:52 am
Contact:

Post by KaReL »

Yes I do.

When I revert back it works, when I place the new files... It doesn't.

The weird part however is that it doesn't crash in any of my code... It crashes somewhere in assembler-thingie?
wxWidgets: SVN/trunk
OS: WinXP/2 + Ubuntu + Mac 10.4.11
Compiler: VS2005 + GCC 4.2 + GCC 4.0.1
-----
home: http://www.salvania.be
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

One last resort is to isolate your problem by taking the minimal sample and copy / paste the code in there. Maybe it won't crash and you know it is a relation to other parts of your code. Also, force a rebuild all, play with debug / compiler settings (e.g. optimizing etc) might help. Those are all pretty standard things and I am sure you already tried them. But like i said if your program crashes 'somewhere' it is hard to give more concrete info ;-) .. Things I always do is;

1. Force a rebuild all
2. Check for unintialised vars
3. Are all constructors ok? No extra methods needed to init ?
4. Is everything freed properly?
5. Does this occur in release or debug mode ?
6. Start to #if 0 .... #endif parts out until I am sure it does not crash anymore
7. When it stops, start adding parts again, and retry
8. If the problem persists start copying over to the minimal sample and see what it does there
9. If it still persists without any reason, minimze the crashing code
10. Send a bug report with the minimized version ...

Can anyone else fill tips and tricks ? Maybe we can put this in a FAQ with common things to do when a crash occurs...

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
KaReL
Experienced Solver
Experienced Solver
Posts: 78
Joined: Mon Aug 30, 2004 8:52 am
Contact:

Post by KaReL »

btw, I found the error... Which ain't very logical ;)

I did wxDELETE(m_pWaarschuwing); where m_pWaarschuwing is an own-created wxTaskBarIcon.

Now I get a huge amount of leaks (we are improving ;)).


Thx for your tip about #if 0 - #endif Jorg... That is more easy then always copy/paste everything. I simply forgot about that :)
wxWidgets: SVN/trunk
OS: WinXP/2 + Ubuntu + Mac 10.4.11
Compiler: VS2005 + GCC 4.2 + GCC 4.0.1
-----
home: http://www.salvania.be
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

You're welcome, glad to be of any help ;-)

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
anderspe
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Dec 07, 2004 12:11 pm

My misstake

Post by anderspe »

Was when a was started win WX that i was using Delete insted of
Destroy after closing a Dialog this gives random strange error to.

So this can bi added to the troble list

// Anders
Post Reply