summaryrefslogtreecommitdiffstats
path: root/Source/cmVariableWatch.cxx
diff options
context:
space:
mode:
authorBen Boeckel <mathstuf@gmail.com>2013-08-06 18:12:54 (GMT)
committerBrad King <brad.king@kitware.com>2013-08-08 17:31:09 (GMT)
commit34b397e8dec04c55b415ee0e5f9172f624156d36 (patch)
treed51a539272c2e142d90d920a7f2f4c49881b532f /Source/cmVariableWatch.cxx
parente43e207c7bbde2a9e0948da0d1e79879ccd5ce45 (diff)
downloadCMake-34b397e8dec04c55b415ee0e5f9172f624156d36.zip
CMake-34b397e8dec04c55b415ee0e5f9172f624156d36.tar.gz
CMake-34b397e8dec04c55b415ee0e5f9172f624156d36.tar.bz2
variable_watch: Allow specifying the data to match in RemoveWatch
Now that watches are dependent on their client_data when adding, it also makes sense to allow matching the data for removal.
Diffstat (limited to 'Source/cmVariableWatch.cxx')
-rw-r--r--Source/cmVariableWatch.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/cmVariableWatch.cxx b/Source/cmVariableWatch.cxx
index c2a899d..d049cdd 100644
--- a/Source/cmVariableWatch.cxx
+++ b/Source/cmVariableWatch.cxx
@@ -77,13 +77,17 @@ bool cmVariableWatch::AddWatch(const std::string& variable,
}
void cmVariableWatch::RemoveWatch(const std::string& variable,
- WatchMethod method)
+ WatchMethod method,
+ void* client_data /*=0*/)
{
cmVariableWatch::VectorOfPairs* vp = &this->WatchMap[variable];
cmVariableWatch::VectorOfPairs::iterator it;
for ( it = vp->begin(); it != vp->end(); ++it )
{
- if ( (*it)->Method == method )
+ if ( (*it)->Method == method &&
+ // If client_data is NULL, we want to disconnect all watches against
+ // the given method; otherwise match ClientData as well.
+ (!client_data || (client_data == (*it)->ClientData)))
{
delete *it;
vp->erase(it);