That fixed the crash. Now I can continue with my original experiments, thanks a lot! Do you consider it a good idea to commit my changes to the file if I don't find something else that's now broken by them? What would be the procedure for that?
If this turns out to be a good fix, it should get added to the autobuild.
Note this may affect whether the canon firmware applies the correct distortion correction after moving the zoom.
To test:
zoom in some using scripted key presses, e.g. 10 clicks
shoot
record the zoom position
zoom back to full wide using clicks
set_zoom to the previously recorded zoom position
shoot
Compare the two jpegs.
I have found that even when the zoom position is reported as identical, the zoom level may be slightly different. This is OK, the main thing to look for is the distortion correction. Using a grid as your subject can be helpful.