Skip to content

[sourcekitd] Fix crash in onDocumentUpdateNotification #14355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ std::string sourcekitd::getRuntimeLibPath() {
}

static void sourcekitdServer_peer_event_handler(xpc_connection_t peer,
xpc_object_t event) {
xpc_object_t event) {
xpc_type_t type = xpc_get_type(event);
if (type == XPC_TYPE_ERROR) {
if (event == XPC_ERROR_CONNECTION_INVALID) {
Expand Down Expand Up @@ -305,6 +305,10 @@ static void sourcekitdServer_event_handler(xpc_connection_t peer) {
sourcekitdServer_peer_event_handler(peer, event);
});

// Update the main connection
xpc_retain(peer);
if (MainConnection)
xpc_release(MainConnection);
MainConnection = peer;

// This will tell the connection to begin listening for events. If you
Expand Down