variable_watch: Fix possible segfault when modified on callback
From discussion in !1230 (merged)
I've also added a commit which has a unit test which triggers the functionality using 'variable_watch' in a cmake file. I expect you'll see that test case crash on many systems without the following commit; although not all. It at least crashes on my linux machine.
This MR basically just makes it not crash; it doesn't attempt to enforce any particular semantics if you remove / insert a new callback within an existing one.
The other way of addressing this would be to copy the vector before running the callbacks; but this could crash if you remove a watchpoint inside the loop.
Topic-rename: variable_watch-modify-on-callback