FSEvents file system watcher: Do not watch whole parent hierarchies.
Unfortunately the FSEvents implementation for watching parent hierarchies has the major flaw, that watching a path will then create watches for the whole parent hierarchy even if that hierarchy is already watched. Watching /A/B/C and /A/B/D will create two watches each for /A and /A/B. This leads to an explosion of open file handles. Luckily we do not need to watch the parent hierarchy since this is not a supported usecase of QFileSystemWatcher anyhow, so just don't do it. Task-number: QTCREATORBUG-13531 Change-Id: I9ecb5f08e4be35e4fbd58a7ca3155867fcb1589f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
parent
a2da88712f
commit
03b5ecce4a
@ -518,7 +518,6 @@ bool QFseventsFileSystemWatcherEngine::startStream()
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
const CFAbsoluteTime latency = .5; // in seconds
|
const CFAbsoluteTime latency = .5; // in seconds
|
||||||
FSEventStreamCreateFlags flags = kFSEventStreamCreateFlagWatchRoot;
|
|
||||||
|
|
||||||
// Never start with kFSEventStreamEventIdSinceNow, because this will generate an invalid
|
// Never start with kFSEventStreamEventIdSinceNow, because this will generate an invalid
|
||||||
// soft-assert in FSEventStreamFlushSync in CarbonCore when no event occurred.
|
// soft-assert in FSEventStreamFlushSync in CarbonCore when no event occurred.
|
||||||
@ -530,7 +529,7 @@ bool QFseventsFileSystemWatcherEngine::startStream()
|
|||||||
reinterpret_cast<CFArrayRef>(pathsToWatch),
|
reinterpret_cast<CFArrayRef>(pathsToWatch),
|
||||||
lastReceivedEvent,
|
lastReceivedEvent,
|
||||||
latency,
|
latency,
|
||||||
flags);
|
FSEventStreamCreateFlags(0));
|
||||||
|
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
DEBUG() << "Failed to create stream!";
|
DEBUG() << "Failed to create stream!";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user