More tests of canceling from callbacks

This covers diff print, push, and ref foreach.  This also has a
fix for a small memory leak in the push tests.