From 0ebe82281d843cfa75b503b9b85854c8429c35dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 4 Nov 2024 19:53:36 +0000 Subject: [PATCH] When forkit installs fonts, sparekits that already exist don't get them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit at least the first spare kit created by forkit_main will exist without the fonts which arrive later Signed-off-by: Caolán McNamara Change-Id: Idd778a40791266b0e2ff7ec6ba02dca6a19d0f23 --- wsd/COOLWSD.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wsd/COOLWSD.cpp b/wsd/COOLWSD.cpp index 20ce92bc2100..e651fbed1ae0 100644 --- a/wsd/COOLWSD.cpp +++ b/wsd/COOLWSD.cpp @@ -1195,6 +1195,14 @@ class RemoteJSONPoll : public SocketPoll std::string _expectedKind; }; +static void requestTerminateSpareKits() +{ + std::unique_lock lock(NewChildrenMutex); + const int count = NewChildren.size(); + for (int i = count - 1; i >= 0; --i) + NewChildren[i]->requestTermination(); +} + class RemoteConfigPoll : public RemoteJSONPoll { public: @@ -1873,6 +1881,13 @@ class RemoteFontConfigPoll : public RemoteJSONPoll COOLWSD::sendMessageToForKit("addfont " + fontFile); + // Request existing spare kits to quit, to get replaced with ones that + // include the new fonts. + if (PrisonerPoll) + { + PrisonerPoll->addCallback([]{ requestTerminateSpareKits(); }); + } + return true; }