billroper: (Default)
billroper ([personal profile] billroper) wrote2016-04-05 11:11 pm
Entry tags:

The Invisible Bug

It was one of those days, at least in some respects.

I had fixed a number of bugs and ported a bunch of code fixes from C++ to Java. But there was an intractable bug that turned out to be due to corrupted data in one of my classes. In fact, what I was seeing was that the child class was pointing back to the wrong parent as its owner.

So it seemed that something had to be wrong with either the copy constructor or the clone() method in my Java code. And I stared at them. And stared at them.

And about a half-hour after I'd started staring, I suddenly realized that I was setting the parent of the children incorrectly when I was cloning the parent class. Because you don't set the parent to this, you set the parent to the newly created parent.

I could easily have stared at that for a lot longer before figuring out that I had typed something witless.

*sigh*

On the other hand, the bug appears to have gone away now.
madfilkentist: My cat Florestan (gray shorthair) (hex)

[personal profile] madfilkentist 2016-04-06 04:27 pm (UTC)(link)
Setting the parent to this sounds like it would involve temporal paradoxes.