diff --git a/shell_integration/windows/NCContextMenu/NCClientInterface.cpp b/shell_integration/windows/NCContextMenu/NCClientInterface.cpp index 380f4e22291b2..c4c4e5ca83e90 100644 --- a/shell_integration/windows/NCContextMenu/NCClientInterface.cpp +++ b/shell_integration/windows/NCContextMenu/NCClientInterface.cpp @@ -48,7 +48,8 @@ NCClientInterface::ContextMenuInfo NCClientInterface::FetchInfo(const std::wstri ContextMenuInfo info; std::wstring response; int sleptCount = 0; - while (sleptCount < 20) { + bool receivedReplayFromDesktopClient = false; + while (receivedReplayFromDesktopClient || sleptCount < 20) { if (socket.ReadLine(&response)) { if (StringUtil::begins_with(response, wstring(L"REGISTER_PATH:"))) { wstring responsePath = response.substr(14); // length of REGISTER_PATH @@ -65,6 +66,9 @@ NCClientInterface::ContextMenuInfo NCClientInterface::FetchInfo(const std::wstri if (!StringUtil::extractChunks(response, commandName, flags, title)) continue; info.menuItems.push_back({ commandName, flags, title }); + } else if (StringUtil::begins_with(response, wstring(L"GET_MENU_ITEMS:BEGIN"))) { + receivedReplayFromDesktopClient = true; + break; // Stop once we completely received the last sent request } else if (StringUtil::begins_with(response, wstring(L"GET_MENU_ITEMS:END"))) { break; // Stop once we completely received the last sent request }