diff --git a/src/menu.cpp b/src/menu.cpp index d44fb75..7d3d756 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -582,6 +582,15 @@ void Menu::removePackageLink(std::string path) } } } + + /* Remove registered monitors */ + for (vector::iterator it = monitors.begin(); + it < monitors.end(); it++) { + if ((*it)->getPath().compare(0, path.size(), path) == 0) { + delete (*it); + monitors.erase(it); + } + } } #endif #endif diff --git a/src/monitor.cpp b/src/monitor.cpp index ca3b24e..754dba6 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -93,5 +93,6 @@ Monitor::~Monitor(void) { pthread_cancel(thd); pthread_join(thd, NULL); + DEBUG("Monitor thread stopped (was watching %s)\n", path.c_str()); } #endif diff --git a/src/monitor.h b/src/monitor.h index 0492fae..181a08b 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -14,6 +14,7 @@ public: virtual ~Monitor(); int run(void); + const std::string getPath(void) { return path; } private: std::string path;