The command itself is owned by the cmMakefile class, but the
cmVariableWatch which holds a pointer to the cmVariableWatchCommand via
the client_data for the callback outlives the cmMakefile class in the Qt
GUI. This means that when the cmMakefile is destroyed, the variable
watch is still in effect, but with a stale pointer.
To fix this, each callback is now a separate entity completely and
doesn't rely on the command which spawned it at all.
An example CMakeLists.txt which demonstrates the issue (only displayed
in cmake-gui, so no tests can be written for it):
set(var 0)
variable_watch(var)
This converts the CMake license to a pure 3-clause OSI-approved BSD
License. We drop the previous license clause requiring modified
versions to be plainly marked. We also update the CMake copyright to
cover the full development time range.
The "Keep only FinalPass commands in memory" commit caused instances of
this command to be deleted after the InitialPass. Even though the
variable_watch command does not have a final pass, it does need to stay
alive because it owns the callback information.