Fixed, fixed, fixed! Yay!... was my first thought. (It was tempered by a dose of reality later.) The fix was actually rather simple, and of a different nature than what I thought it would be. That is, it did not come by figuring out what to change in the Gallery2 code. I tried that first, but in the process of debugging the code I hosed it even more than it was already hosed. :-) Basically, I dug myself into a hole, and then dug myself out of it by taking a different route. I won't post the details of the fix here, since they are too tedious for my this blog. I have posted them on my web site instead, so that perhaps someone someday could benefit from my experience.
I was about to celebrate the fix by adding a new, funny image to Gallery. However... trying to upload an image I got an error. So much for joy. Well, at least it is possible to view the images that are already there. That's better than nothing, but still... if it turns out that my fix broke Gallery in a way that makes it impossible to add new pictures, it won't be much of a fix.