Monday, October 23, 2006

Got that bug

Last night we had some bug that kept us awake for a long time. What happened was that the application was booming randomly after re-registering it (something that is not supposed to happen very often, if at all). Pedro signaled that was probably GUI related, he ended up being right.

In order to nail the bug, I was using Xcode's debugger. Unfortunately Xcode's debugger did not show up any information about processes being run. I made some changes to the code, and by temporarely eliminating some pieces I finally managed to get to the offending code statement. It was around 2am.

I read the statement a few times. I could not make out what was happening. I did some more testing. Finally, I looked at the local variables. Found something wierd. We had an string that had an invalid pointer. What was the reason? 2:30am and I was still tracing code. Made some more changes. Finally, around 3:10, I found it.

The bug was due to the fact that at some stage, in one of our classes, we were retaining twice the same variable. We actually ment to retain 2 different ones, so the one that was not retained ended up causing the invalid pointer. As we were using KVO methods to assign a value to that variable, so it would be shown in the GUI, the hold thing exploded.

Fixed, we are getting there.

No comments: