summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemwatcher_fsevents.mm
Commit message (Collapse)AuthorAgeFilesLines
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Fix removal of trailing slashMarcus Tillmanns2022-05-131-6/+6
| | | | | | | | | | | | The fsevents implementation of QFileSystemWatcher on Mac OS X tries to remove trailing slashes from the paths when calling addPaths(). If the user tries to watch "/", the path is changed to "". The fix checks whether the path is longer than 1 before removing trailing slashes. Change-Id: Iafb10e449c4f3bd600b02edbe7c549911db05048 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix race in QFseventsFileSystemWatcher destructorErik Verbruggen2020-07-241-6/+8
| | | | | | | | | | | | | | | | | | | | | | The race goes like this: 1) We destruct QFseventsFileSystemWatcher, which calls FSEventStreamStop and FSEventStreamInvalidate/FSEventStreamRelease 2) The FSEvent* calls will happen on the same thread as the destructor is being called on, which will be different to the thread that the FSEvent* events are popping out on. 3) So, there could be a case where we are in the middle of processing an event, but the QFseventsFileSystemWatcher has already died. The fix is to dispatch the stop/invalidate/release on the queue associated with the stream. Patch by Matt Galloway! Fixes: QTBUG-85594 Pick-to: 5.15 5.12 Change-Id: Ie168bbe91e55c5559632b37bc008e11597e4fdaf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: Remove all use of deprecated Q_OS_OSX defineTor Arne Vestbø2020-04-031-1/+1
| | | | | Change-Id: I49c285604694c93d37c9d1c7cd6d3b1509858319 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFseventsFileSystemWatcherEngine: port some Java-style iterators to ranged-forMarc Mutz2019-07-031-15/+15
| | | | | | | | | | | | | | | | | | | | | | Amends b03385f9cff7acc2b37933f493e3eff2d8bbef59. Java-style iterators are scheduled to be deprecated. The general pattern used in the patch is that instead of copying an input list, then iterating over the copy with some calls to it.remove() (which leads to quadratic-complexity loops), we simply copy conditionally (a la remove_copy_if instead of remove_if). To make clearer what's going on, rename the outgoing list to 'unhandled'. To avoid having to touch too much of the loops' structure, which sometimes is quite convoluted, use qScopeGuard to do the append to 'unhandled', unless the original code removed the element. Change-Id: I808a939b9c816b329ee87620e0a3461fee6e3e40 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Replace qMove with std::moveAllan Sandfeld Jensen2019-04-061-2/+2
| | | | | | Change-Id: I67df3ae6b5db0a158f86e75b99f422bd13853bc9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-09-301-4/+0
|\ | | | | | | Change-Id: Iaa438d14357be1bf75bb645cb8d3245947c055b8
| * Modernize the "filesystemwatcher" featureLiang Qi2018-09-271-4/+0
| | | | | | | | | | | | Change-Id: If030b56ad97e047d89d442629262b4839df306d4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-06-071-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/kernel/qeventdispatcher_cf.mm src/gui/kernel/qguiapplication_p.h src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/qioseventdispatcher.mm src/plugins/platforms/windows/qwindowsdrag.h src/plugins/platforms/windows/qwindowsinternalmimedata.h src/plugins/platforms/windows/qwindowsmime.cpp src/plugins/platforms/winrt/qwinrtscreen.cpp Change-Id: Ic817f265c2386e83839d2bb9ef7419cb29705246
| * macOS: Fix QFileSystemWatcher to watch paths with the same prefixMikhail Svetkin2018-05-291-1/+1
| | | | | | | | | | | | | | | | | | It happens because our filesystemwatcher thinks it is subdirectory and not two different paths Task-number: QTBUG-60676 Change-Id: Ic753e9481cb26303a030044e0a5ab4d703bc529f Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Clean up our Objective-C usageJake Petroules2018-02-201-1/+1
|/ | | | | | | | | | | | | | | | - Move ivars into @implementation - Use instancetype where applicable - Use dot notation for property access - Use subscript operator for dictionaries and arrays - Format selectors consistently - Use proper style for init methods - Use generics instead of void pointers where possible - Use "range for" loops instead of indexing - Replace or replace IBAction/IBOutlet with void Change-Id: I1667812a51d4dfe44ae80fe337cb1f4bc9699d92 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-1/+1
| | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-011-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/win/msvc_version.cpp configure.pri mkspecs/macx-ios-clang/features/default_post.prf mkspecs/macx-ios-clang/features/resolve_config.prf mkspecs/features/uikit/default_post.prf mkspecs/features/uikit/resolve_config.prf src/corelib/io/qsettings_mac.cpp src/corelib/json/qjsondocument.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.h src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/ios.pro src/plugins/platforms/ios/kernel.pro src/plugins/platforms/ios/qiosintegration.h src/plugins/platforms/minimalegl/qminimaleglintegration.cpp tests/auto/gui/painting/qpainter/tst_qpainter.cpp tools/configure/environment.cpp Change-Id: I654845e54e40f5951fb78aab349ca667e9f27843
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-271-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/ios/ios.pro src/plugins/platforms/ios/kernel.pro src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.h src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileenginefactory.h src/plugins/platforms/ios/qiosintegration.h src/widgets/widgets/qcombobox.cpp tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp Change-Id: Ibaee7cbbba99e7c4b1d8926e55932ffa6030ce45
| | * Darwin: normalize all watched paths to composed fromErik Verbruggen2016-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will be done by all POSIX APIs for strings coming in that way, but because other code (like NSWhateverViews) will most likely return decomposed form, we make sure that those are in composed form too. Task-number: QTBUG-55896 Change-Id: I065e11cee6b59706d4346ed20d4b59b9b95163b8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-10-111-41/+62
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/image/qpixmap.cpp src/widgets/kernel/qformlayout.cpp Change-Id: I8a8391a202adf7f18464a22ddf0a6c4974eab692
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-081-41/+62
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qhttpnetworkconnection.cpp src/network/access/qhttpnetworkconnection_p.h Change-Id: I11f8641ef482efa8cee1b79977d19cc3182814b4
| | * Darwin: correct state restore when FSEventsStream starting failsErik Verbruggen2016-10-071-41/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous state was not restored completely when adding/removing paths resulted in a stream start failure. It also removes an autoreleasepool in restartStream, because both stopStream and startStream do already create an autoreleasepool of their own. (So, this pool will always be empty.) Change-Id: Idc674e9c040f346703ab3ec256957e787a0ade73 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | Remove all code paths related to unsupported Apple platforms.Jake Petroules2016-06-041-7/+1
|/ / | | | | | | | | | | | | | | | | Now that the minimum deployment target (and thus SDK) is 10.9 for OS X and 7.0 for iOS, all code paths affecting platform versions lower than the aforementioned are removed. Change-Id: Id985c7259c4ac069319d88f2c29c9559ae9e8641 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* / Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add shared implementation of a NSAutoreleasePool wrapper to qglobalTor Arne Vestbø2015-05-271-25/+6
| | | | | | | | | | | We have at least 5 different (but equal) implementations of a wrapper in Qt, and some code uses explicit NSAutoreleasePools. Having a shared implementation lets us clean up things a bit and makes it easier to reason about which pools are actually needed. Change-Id: I2fd8eefc3ae7308595ef9899b7820206268362a5 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fixed license headersJani Heikkinen2015-02-171-1/+1
| | | | | Change-Id: Ibebe1318d1c2de97601aa07269705c87737083ee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Pass params of shareable type by const-ref rather than by valueKonstantin Ritt2015-02-131-6/+6
| | | | | | | | ...where passing them by value was not intentional. Change-Id: Ifd5036d57b41fddeeacfbd3f5890881605b80647 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright headersJani Heikkinen2015-02-111-22/+14
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* FSEvents file system watcher: Do not watch whole parent hierarchies.Eike Ziller2014-12-011-2/+1
| | | | | | | | | | | | | | | | 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>
* Fix hangs on QFileSystemWatcher.Leonard Lee2014-09-301-0/+1
| | | | | | | | | | | QFileSystemWatcher hangs at a mutex or semaphore when adding network paths on OS X system. There is an else block that does not increment the 'it' iterator with ++it; inside the QFseventsFileSystemWatcherEngine::checkDir() call. Change-Id: I6c250c7f3d25399c3a0a58ce864e9466320b166b Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
* Fix a memory leak in QFseventsFileSystemWatcherEngineAndy Shaw2014-08-181-0/+1
| | | | | | | | Add a missing NSAutoReleasePool Task-number: QTBUG-38637 Change-Id: Ib69d92b6e9c4327cbb74f7814a45773bfc2ee526 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Fix memory leaks in QFseventsFileSystemWatcherEngineErik Verbruggen2014-06-241-0/+28
| | | | | | | | Sprinkle in some NSAutoReleasePools. Task-number: QTBUG-38637 Change-Id: I0cb42d9d1cbcc4e9d273d0d43e4925fc02885b66 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* Mac: Use QString::toNSString in QtBase.Morten Johan Sørvig2014-04-031-1/+1
| | | | | | | | | | | The string is now autoreleased. This fixes a memory leak in qt_mac_QStringListToNSMutableArrayVoid Task-number: QTBUG-20347 Change-Id: I11ebeb264af4c8ce98968f2221eea772f24c12d4 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Mac: make FSEvents-based QFileSystemWatcherEngine more robust.Erik Verbruggen2014-03-271-37/+97
| | | | | | | | | | | | | | | | | | | - Record the last event ID with every callback. This event ID is passed to FSEventStreamCreate when restarting the stream, so the watcher will receive all events that occurred since invalidating the previous stream. - Never start with kFSEventStreamEventIdSinceNow, because this will generate a (bogus) soft-assert in FSEventStreamFlushSync in CarbonCore when no event occurred since stream creation. The last globally generated event ID is used instead to simulate the "now". - Do not dispose and recreate the stream in the callback, but use a queued signal-slot connection to schedule this on thread that owns the watcher. Change-Id: I02f5a845d9e27f9853ed97925ab9c7a5bc0dede1 Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
* Mac: FSEvents-based QFileSystemWatcherEngine.Erik Verbruggen2014-02-141-0/+507
Use FSEvents to monitor changes in the filesystem instead of the kqueue implementation. This removes the limit of wathed files: kqueue uses a file descriptor for each file monitored, for which the ulimit was set by default to 256. Now the OSX implementation on par with the other major desktop platforms. Change-Id: I2d46cca811978621989fd35201138df88a37c0fb Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>