Skip to content

Commit

Permalink
REGRESSION (275491@main): [ iOS Debug ] 2x TestWebKitAPI.WKWebView.Pr…
Browse files Browse the repository at this point in the history
…intToPDFUsingPrint API tests are constant crashes

https://bugs.webkit.org/show_bug.cgi?id=270523
rdar://124076626

Reviewed by Aditya Keerthi.

In 275494@main, HashMap::isValidKey was used to check if the map contained the key. This is obviously incorrect.
Use HashMap::contains instead.

* Source/WebKit/Platform/IPC/Connection.cpp:
(IPC::Connection::isAsyncReplyHandlerWithDispatcher):
(IPC::Connection::takeAsyncReplyHandlerWithDispatcherWithLockHeld): Similar to taskReplyHandler, check if the key is valid first.

Canonical link: https://commits.webkit.org/275733@main
  • Loading branch information
jyavenard committed Mar 6, 2024
1 parent e555f81 commit c9cfcce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Source/WebKit/Platform/IPC/Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ CompletionHandler<void(Decoder*)> Connection::takeAsyncReplyHandler(AsyncReplyID
bool Connection::isAsyncReplyHandlerWithDispatcher(AsyncReplyID replyID)
{
Locker locker { m_incomingMessagesLock };
return m_asyncReplyHandlerWithDispatchers.isValidKey(replyID);
return m_asyncReplyHandlerWithDispatchers.isValidKey(replyID) && m_asyncReplyHandlerWithDispatchers.contains(replyID);
}

Connection::AsyncReplyHandlerWithDispatcher Connection::takeAsyncReplyHandlerWithDispatcher(AsyncReplyID replyID)
Expand All @@ -1504,6 +1504,8 @@ Connection::AsyncReplyHandlerWithDispatcher Connection::takeAsyncReplyHandlerWit
Connection::AsyncReplyHandlerWithDispatcher Connection::takeAsyncReplyHandlerWithDispatcherWithLockHeld(AsyncReplyID replyID)
{
assertIsHeld(m_incomingMessagesLock);
if (!m_asyncReplyHandlerWithDispatchers.isValidKey(replyID))
return { };
return m_asyncReplyHandlerWithDispatchers.take(replyID);
}

Expand Down

0 comments on commit c9cfcce

Please sign in to comment.