Andrew Coppin wrote:
I'm actually wondering if my code is writing off the end of an array and this "just happens" to hit some data structure used by GTK+? (In which case, minute changes in linkage, etc., would disturb the bug.)

Yep, that's what it was. (Although not where I was expecting it to be, which kept me guessing for a while...) I thought that all write operations go to the IOUArray, except for the loop that copies it to the Pixbuf. (This loop is constructed such that it cannot go out of bounds, while the ad-hoc writing uses user-supplied coordinates.) I forgot about the second drawing pass, which does write directly to the Pixbuf. *This* appears to be the source of my bug; if you add a range check, the bug goes away. (Oddly, I added the range check back to the IOUArray as well, and even though it's writing the same coordinates, no error is reported. I guess I must have an off-by-one bug as well...!)

So there you have it. Premature optimisation => buffer overrun => end of civilisation as we know it. :-/

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to