mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
gui/macOS: Correctly release objects received via FileProviderUtils functions
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
1b56f2e38a
commit
6eca65b888
@ -147,6 +147,8 @@ QString FileProviderItemMetadata::getUserVisiblePath() const
|
||||
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
|
||||
dispatch_release(semaphore);
|
||||
|
||||
[manager release];
|
||||
|
||||
return returnPath;
|
||||
}
|
||||
|
||||
|
||||
@ -59,6 +59,8 @@ void FileProviderMaterialisedItemsModel::evictItem(const QString &identifier, co
|
||||
}];
|
||||
|
||||
dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, 3 * NSEC_PER_SEC));
|
||||
[manager release];
|
||||
|
||||
if (successfullyDeleted == NO) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -167,6 +167,7 @@ public:
|
||||
qCInfo(lcFileProviderSettingsController) << "Signalling file provider domain" << userIdAtHost;
|
||||
NSFileProviderDomain * const domain = FileProviderUtils::domainForIdentifier(userIdAtHost);
|
||||
NSFileProviderManager * const manager = [NSFileProviderManager managerForDomain:domain];
|
||||
[domain release];
|
||||
[manager signalEnumeratorForContainerItemIdentifier:NSFileProviderRootContainerItemIdentifier
|
||||
completionHandler:^(NSError *const error) {
|
||||
if (error != nil) {
|
||||
@ -186,6 +187,7 @@ public:
|
||||
}
|
||||
|
||||
public slots:
|
||||
// NOTE: This method will release the provided args so make sure to retain them beforehand
|
||||
void enumerateMaterialisedFilesForDomainManager(NSFileProviderManager * const managerForDomain,
|
||||
NSFileProviderDomain * const domain)
|
||||
{
|
||||
@ -228,6 +230,9 @@ public slots:
|
||||
|
||||
[storageUseObserver release];
|
||||
[enumerator release];
|
||||
|
||||
[managerForDomain release];
|
||||
[domain release];
|
||||
};
|
||||
[enumerator enumerateItemsForObserver:storageUseObserver startingAtPage:NSFileProviderInitialPageSortedByName];
|
||||
}
|
||||
@ -283,7 +288,8 @@ private:
|
||||
<< ", returning early.";
|
||||
return;
|
||||
}
|
||||
|
||||
[managerForDomain retain];
|
||||
[domain retain];
|
||||
enumerateMaterialisedFilesForDomainManager(managerForDomain, domain);
|
||||
}
|
||||
}];
|
||||
|
||||
@ -29,6 +29,10 @@ class QString;
|
||||
*
|
||||
* You should threfore try to avoid using this in C++ code wherever possible
|
||||
* and only use this in *_mac.mm implementation files.
|
||||
*
|
||||
* IMPORTANT: All Objective-C objects returned here need to be released!
|
||||
* They have been internally retained due to the async nature of the
|
||||
* FileProvider API.
|
||||
*/
|
||||
|
||||
namespace OCC {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user