Repository navigation
fix(file-provider): Build XPC components with ARC - #11081
claucambra wants to merge 7 commits into
Conversation
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
|
/backport to stable-35.0 |
…abled Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
i2h3
left a comment
There was a problem hiding this comment.
Wait… No, actually, this does not compile. 😅 It looks good but there is a problem with it.
Must fix
-
The branch does not compile (
src/gui/macOS/fileproviderxpc_mac_utils.mm:93,:139)- What this is:
getFileProviderServicesandconnectToFileProviderServiceswait on a dispatch group and then free it. - Problem: These two
dispatch_release(group)calls were missed in the ARC conversion. Under-fobjc-arc, clang fails with'release' is unavailable: not available in automatic reference counting mode. - Fix: Delete both lines, as was already done in
getDomainManagersandgetFileProviderDomainIdentifier. - If we skip it: Every build with
BUILD_FILE_PROVIDER_MODULE=ONfails, and so does this commit when bisecting.
- What this is:
-
FileProviderXPCUtilsTestno longer compiles, and its ownership checks are now wrong (test/macOS/testfileproviderxpcutils.cpp,src/gui/macOS/fileproviderxpc_mac_utils.h:19)- What this is: The test checks who owns the objects that the XPC utilities return. It is built with
-x objective-c++and without-fobjc-arc(test/macOS/CMakeLists.txt:14). - Problem: The header now contains
static_assert(__has_feature(objc_arc)), so the test fails to compile. Even without the assert, the test still callsreleaseon values that ARC now returns at +0 ([services release]at lines 203 and 215,[domainIdentifier release]at line 228). That over-releases them and crashes. - Fix:
- Compile the test with
-fobjc-arcnext to-x objective-c++. - Remove the manual
releasecalls, and take the returned pointers back with__bridge_transfer. - Wrap the
processClientCommunicationConnectionscalls in@autoreleasepool { }before the*Deallocatedchecks. - Drop or rename
clientCommunicationDomainIdentifierCanBeReleasedByCaller, because the +1 contract it tests no longer exists. - Move the
static_assertfrom the header intofileproviderxpc_mac_utils.mmandfileproviderxpc_mac.mm, as every other ARC file does (e.g.src/gui/macOS/fileprovider_mac.mm:18).
- Compile the test with
- If we skip it: CI fails when tests are built, and nothing tests the new ownership contract.
- What this is: The test checks who owns the objects that the XPC utilities return. It is built with
Should fix
- AGENTS.md now says every Objective-C file uses ARC, but 8 files still do not (
AGENTS.md:218)- What this is: This rule tells agents which memory-management model to follow.
- Problem: These files still use manual reference counting:
src/gui/cocoainitializer_mac.mm,src/gui/macOS/fileproviderservice.mm,src/gui/macOS/findersyncservice.mm,src/gui/macOS/findersyncxpc_mac.mm,src/gui/macOS/localnetworkpermission.mm,src/gui/updater/sparkleupdater_mac.mm,src/libsync/settingsources_mac.mmandsrc/libsync/theme_mac.mm. The old warning against ARC-only features in those files is gone. An agent that editsfindersyncxpc_mac.mmand follows the new rule leaves outrelease, so the object leaks without any warning. Or the agent converts the whole file as an unrelated side change. - Fix: Keep the new rule as the goal, and add one sentence: files not yet compiled with
-fobjc-arc(seesrc/gui/CMakeLists.txtandsrc/common/common.cmake) still use manual reference counting until a separate change converts them. - If we skip it: Agents add leaks to the files that still use manual reference counting.
Nice to have
- A copy that is no longer needed (
src/gui/macOS/fileproviderxpc_mac_utils.mm:203)- What this is:
getFileProviderDomainIdentifierreturns the domain identifier as anNSString. - Problem:
[[NSString alloc] initWithString:...]only existed to give manual-reference-counting callers a +1 object to release. Under ARC it is an extra copy. - Fix:
return domainIdentifier.toNSString(); - If we skip it: Each call makes one small extra copy. Nothing breaks.
- What this is:
Assisted-by: Codex:GPT-6 Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Compile the tests with ARC and adopt retained opaque pointers with bridge transfers. Check object lifetimes after input owners and autorelease pools drain, and keep ARC assertions in the implementation files. Assisted-by: Codex:GPT-6 Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Require ARC for new Objective-C sources while preserving manual reference counting in existing files until they are migrated separately. Assisted-by: Codex:GPT-6 Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Assisted-by: Codex:GPT-6 Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
|
@i2h3 thanks for the comments
looks like I missed what broke when I extracted this from the original xpc timeout branch
also fixed
thanks, fixed
also fixed |
Enable ARC for Cocoa startup, local network permission probes, FinderSync services and XPC, the File Provider service, and Sparkle. Keep application startup in a scoped autorelease pool, balance opaque XPC references, and detach native delegates before their C++ owners disappear. Add regression coverage for native object lifetime, queued replies, cancellation, teardown, and late callbacks. Assisted-by: Codex:GPT-6 Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
5014332 to
58f0c15
Compare
|




Summary
Adds remaining XPC components to ARC build
Checklist
AI (if applicable)