Skip to content

Commit 62e174e

Browse files
mcleinmanoskirby
andauthored
VPN-7317: Fix XPC connection use-after-free after sign-out (#10823) (#10824)
Co-authored-by: Naomi Kirby <[email protected]>
1 parent fd6a883 commit 62e174e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/platforms/macos/macoscontroller.mm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ - (id)initWithObject:(ControllerImpl*)controller;
4747

4848
MacOSController::~MacOSController() {
4949
if (m_connection != nil) {
50-
[static_cast<NSXPCConnection*>(m_connection) release];
50+
NSXPCConnection* conn = static_cast<NSXPCConnection*>(m_connection);
51+
[conn invalidate];
52+
[conn release];
5153
}
5254
}
5355

@@ -222,6 +224,9 @@ - (id)initWithObject:(ControllerImpl*)controller;
222224
QJsonObject jsObj = QJsonDocument::fromJson(jsBlob).object();
223225
emit initialized(true, jsObj.value("connected").toBool(),
224226
QDateTime::fromString(jsObj.value("date").toString()));
227+
228+
// The delegate is now owned by the NSXPCConnection
229+
[delegate release];
225230
}];
226231
}
227232

0 commit comments

Comments
 (0)