diff options
-rw-r--r-- | Source/cmVariableWatch.cxx | 8 | ||||
-rw-r--r-- | Source/cmVariableWatch.h | 3 |
2 files changed, 8 insertions, 3 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); diff --git a/Source/cmVariableWatch.h b/Source/cmVariableWatch.h index 3b6cafd..790c75a 100644 --- a/Source/cmVariableWatch.h +++ b/Source/cmVariableWatch.h @@ -36,7 +36,8 @@ public: */ bool AddWatch(const std::string& variable, WatchMethod method, void* client_data=0, DeleteData delete_data=0); - void RemoveWatch(const std::string& variable, WatchMethod method); + void RemoveWatch(const std::string& variable, WatchMethod method, + void* client_data=0); /** * This method is called when variable is accessed |