fix: thread-safe signal emission in FileProviderService XPC callback#9349
Merged
i2h3 merged 3 commits intoi2h3/fix/9682755-excluded-sync-statusfrom Jan 21, 2026
Merged
Conversation
Use QMetaObject::invokeMethod with Qt::QueuedConnection to emit the syncStateChanged signal from the Objective-C callback that may be called on an XPC dispatch queue (non-main thread). This ensures the signal is emitted on the correct thread where the FileProviderService object lives, preventing potential thread safety issues. Co-authored-by: i2h3 <142165879+i2h3@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix File Provider Synchronization Status based on review feedback
fix: thread-safe signal emission in FileProviderService XPC callback
Jan 21, 2026
Collaborator
|
@copilot Resolve the conflicts! |
Copilot stopped work on behalf of
i2h3 due to an error
January 21, 2026 10:29
…-pr-9335-again Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
i2h3
approved these changes
Jan 21, 2026
a409208
into
i2h3/fix/9682755-excluded-sync-status
14 of 15 checks passed
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request addresses a thread-safety issue in the FileProviderService XPC communication layer by ensuring signals are emitted on the correct thread. The syncStateChanged signal was previously emitted directly from an Objective-C XPC callback executing on a dispatch queue, which violated Qt's thread-safety requirements for signal emission.
Changes:
- Replace direct signal emission with
QMetaObject::invokeMethodusingQt::QueuedConnectionto queue signal emission to the FileProviderService object's thread - Add
QMetaObjectheader include for the invokeMethod API - Add explanatory comment documenting the thread-safety rationale
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Addresses feedback from #9335 regarding thread safety in the FileProviderService XPC communication layer.
Description
The
syncStateChangedsignal was emitted directly from an Objective-C XPC callback that executes on a dispatch queue, not the main thread. Qt signals require emission on the object's thread to maintain signal/slot connection guarantees.Changes
QMetaObject::invokeMethodwithQt::QueuedConnectionto queue signal emission to the FileProviderService object's threadThis follows established Qt patterns for cross-thread signal emission and matches usage elsewhere in the codebase.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.