For about a week now I am stuck with finding a certain bug in my code. Every time I run it OS4 crashes. What I have done far:

– Opening all the libraries and classes

– Setting up my window parameters

– Opening the window

If I run the code it displays the window but instantly brings up the Grim Reaper saying it crashed. Being the smart ass as I am I believe my code is clean as a whistle. 🙂 The problem is how to you find this bug? My first thought was that it goes wrong at the “looping” part. This is the part that keeps the window displayed until someone closes it. But after checking and comparing my code  I really code not spot a wrong line of code. To narrow it down I started printing text on the screen after each line of code so I know what part works. The benefit of this is that I soon discovered that it does not even get to the looping part.

A good practice sometimes is that if you really can’t find the problem to take some example code that does work and strip it of all it’s extra’s till it does only what you failed to achieve with your approach. Once you have that you just continue from there. Since I am running the Pre-release version of OS4 I also have to consider that sometimes the code is just fine but it is the Pre-release version that is causing it. Time to squash that bug.

Advertisements