summaryrefslogtreecommitdiff
path: root/src/configuration.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-11-01 00:09:32 +0300
committerAndrei Karas <akaras@inbox.ru>2013-11-01 00:09:32 +0300
commit029818ba44703c5151f8d916284e307b05d08fa9 (patch)
tree785726402146454e69acf1b18ad12f6890e29932 /src/configuration.cpp
parent1936a2bcfad1b37385aec3d84efabf2570a8c9e8 (diff)
downloadplus-029818ba44703c5151f8d916284e307b05d08fa9.tar.gz
plus-029818ba44703c5151f8d916284e307b05d08fa9.tar.bz2
plus-029818ba44703c5151f8d916284e307b05d08fa9.tar.xz
plus-029818ba44703c5151f8d916284e307b05d08fa9.zip
Add configure option --enable-checks for check some calls (disabled by default)
Also add configuration listeners removing in objects.
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r--src/configuration.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 489755341..d9a9df3ab 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -842,6 +842,27 @@ void Configuration::removeListener(const std::string &key,
mListenerMap[key].remove(listener);
}
+#ifdef ENABLE_CHECKS
+void Configuration::checkListeners(ConfigListener *const listener,
+ const char *const file,
+ const unsigned line)
+{
+ FOR_EACH (ListenerMapIterator, it, mListenerMap)
+ {
+ Listeners listeners = it->second;
+ FOR_EACH (ListenerIterator, it2, listeners)
+ {
+ if (*it2 == listener)
+ {
+ logger->log("detected not cleaned listener: %p, %s:%u",
+ static_cast<void*>(listener), file, line);
+ exit(1);
+ }
+ }
+ }
+}
+#endif
+
void Configuration::removeListeners(ConfigListener *const listener)
{
FOR_EACH (ListenerMapIterator, it, mListenerMap)