Some additional possibly related crashes:
https://chdk.setepontos.com/index.php?topic=14068.msg143783#msg143783While the OP saw some difference between 1.4 and 1.5, in my testing the AFScanDriver.c assert is possible to trigger in either with roughly the same code. It appears to be related to trying to change zoom close to half shoot being released (including after a shot is finished) so the simple workaround is just to put some (uncertain) sleep in between.
On elph180, the assert can be triggered by the following, if continuous AF is enabled
=press'shoot_half' repeat sleep(10) until get_shooting() release'shoot_half' sleep(200) set_zoom(get_zoom()+1)
A sleep of 300 doesn't trigger it. Trying to zoom immediately after release, before get_shooting goes false triggers a different assert (ComputerZoom.c Line 2021 in CZ task, regardless of cont AF setting). Another assert can also happen shortly after get_shooting goes false (Imager.c Line 816 in AFTask, only when cont AF enabled?)
The AFScanDriver.c assert happens in elph180 function ff8f4078, based on the result of a call to another function (ff99fdf8) not having the lowest bit set.
There are several possible ways ff99fdf8 can get its return value, but I verified in this case it's caused by TryTakeSemaphore returning non-zero.
I don't see an obvious way to make set_zoom() safe from this. Disallowing zoom while get_shooting is true won't help, although it might avoid the CZ crash.