Skip to content

Commit ddea8b1

Browse files
committed
[macOS] UI process sometimes crashes under ViewGestureController::disconnectFromProcess()
https://bugs.webkit.org/show_bug.cgi?id=287493 rdar://143899055 Reviewed by Charlie Wolfe and Abrar Rahman Protyasha. Null check `m_mainFrameProcess` before attempting to remove the `ViewGestureController` message receiver. In the case where the main `WebProcessProxy` outlives the controller, `WebProcessProxy` teardown should already have cleaned up message receivers (and invoked any messages pending reply) anyways, so it should be safe to avoid this removal step. * Source/WebKit/UIProcess/ViewGestureController.cpp: (WebKit::ViewGestureController::disconnectFromProcess): Canonical link: https://commits.webkit.org/290239@main
1 parent 183f726 commit ddea8b1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Source/WebKit/UIProcess/ViewGestureController.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ void ViewGestureController::disconnectFromProcess()
112112
if (!m_isConnectedToProcess)
113113
return;
114114

115-
Ref { *m_mainFrameProcess }->removeMessageReceiver(Messages::ViewGestureController::messageReceiverName(), *m_webPageIDInMainFrameProcess);
116-
m_mainFrameProcess = nullptr;
115+
if (RefPtr mainFrameProcess = std::exchange(m_mainFrameProcess, nullptr).get())
116+
mainFrameProcess->removeMessageReceiver(Messages::ViewGestureController::messageReceiverName(), *m_webPageIDInMainFrameProcess);
117+
117118
m_webPageIDInMainFrameProcess = std::nullopt;
118119
m_isConnectedToProcess = false;
119120
}

0 commit comments

Comments
 (0)