I've been doing more testing and found out some interesting things. But first:
I think I have a different perspective on this shoot() bug thing. My feeling is that we need to find the cause of it, and a temporary work around that hangs re-shooting would be best to help us find the cause, if it happens. Re-shooting is not the answer, nor is an error return. We don't know the answer.
I thought of one more possibility. This bug only seems to be triggered by AS_SHOOT, and not by the equivalent press("shoot_half") etc. done in a script. So what's the difference between the two? Well, one thing is that there's no delay in AS_SHOOT between get_shooting() becoming true and press("shoot_full"). It's possible that get_shooting() could switch to true, but the camera isn't quite ready to shoot instantly. If the AS_SHOOT presses shoot_full during this time, it just might cause the problem. It wouldn't happen very often, because the timing between threads would have to sync up just right, but that's what we're seeing.
Anyway, it's a theory, and an easy one to test. Just add a short delay before pressing shoot_full in AS_SHOOT. I'll give it a try.
====
While looking into the set_sv96(sv) function, I discovered something strange:
while ((shooting_is_flash_ready()!=1) || (focus_busy));
I'm inclined to just delete this line. Does it have any purpose? Should it at least be changed to this?
while ((shooting_is_flash_ready()!=1) || (focus_busy))msleep(10);
The only other place I found focus_busy is in wrappers.c
_MoveFocusLensToDistance((short*)&newpos);
while ((shooting_is_flash_ready()!=1) || (focus_busy)) msleep(10);
While experimenting with focus_busy, I discovered another interesting thing. Setting the focus override on my sx260 to infinity does nothing in auto-focus mode. In manual mode, it crashes the camera on the next half_shoot.
However, in manual focus mode, but with safety manual focus ON, it focuses at infinity! It sounds like manual focus mode turns off the focus motor completely, so if you try to focus... crash. Safety manual focus leaves it on. I need to test it with set_focus() in half_shoot, which crashes the camera in manual focus without safety MF. Focus bracketing in continuous works, but it looks like the "safety" part is messing up the bracketing.