Mercurial > hg > easyhg
changeset 730:f1dc72b940d5
Crude way to avoid callback on a deleted watcher on exit (macOS)
author | Chris Cannam |
---|---|
date | Mon, 17 Dec 2018 10:54:29 +0000 |
parents | cd4617b18960 |
children | 2cb03c4665aa |
files | src/fswatcher.cpp |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fswatcher.cpp Mon Dec 17 09:50:16 2018 +0000 +++ b/src/fswatcher.cpp Mon Dec 17 10:54:29 2018 +0000 @@ -91,6 +91,8 @@ * drop 10.4 support for EasyMercurial. */ +static bool abandoning = false; // emergency flag for use by non-member callback + FsWatcher::FsWatcher() : m_lastToken(0), m_lastCounter(0) @@ -107,6 +109,8 @@ FsWatcher::~FsWatcher() { + QMutexLocker locker(&m_mutex); + abandoning = true; } void @@ -151,6 +155,7 @@ const FSEventStreamEventFlags /* eventFlags */[], const FSEventStreamEventId /*eventIDs */[]) { + if (abandoning) return; FsWatcher *watcher = reinterpret_cast<FsWatcher *>(clientCallBackInfo); const char *const *cpaths = reinterpret_cast<const char *const *>(paths); for (size_t i = 0; i < numEvents; ++i) {