1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-29 17:17:31 +02:00

Stop watching a directory when it has been reported as removed

This commit is contained in:
Paul Cercueil 2013-07-19 14:35:45 -04:00
parent ebce540dfc
commit b6dfdc6ef5
3 changed files with 11 additions and 0 deletions

View File

@ -582,6 +582,15 @@ void Menu::removePackageLink(std::string path)
} }
} }
} }
/* Remove registered monitors */
for (vector<Monitor *>::iterator it = monitors.begin();
it < monitors.end(); it++) {
if ((*it)->getPath().compare(0, path.size(), path) == 0) {
delete (*it);
monitors.erase(it);
}
}
} }
#endif #endif
#endif #endif

View File

@ -93,5 +93,6 @@ Monitor::~Monitor(void)
{ {
pthread_cancel(thd); pthread_cancel(thd);
pthread_join(thd, NULL); pthread_join(thd, NULL);
DEBUG("Monitor thread stopped (was watching %s)\n", path.c_str());
} }
#endif #endif

View File

@ -14,6 +14,7 @@ public:
virtual ~Monitor(); virtual ~Monitor();
int run(void); int run(void);
const std::string getPath(void) { return path; }
private: private:
std::string path; std::string path;