summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2024-03-27 17:25:24 +0000
committerMichael Meeks <michael.meeks@collabora.com>2024-03-28 17:07:15 +0100
commitccc2e526d107a353469b5aad99e94544c07a10ee (patch)
treeb47c23b10fb045685220510610df601c1c1a10c9 /desktop
parent86837b3d67cfe48a9983a13c5794147e192491a0 (diff)
lok: add isForkedChild method.
This can be used to tag short-lived transient 'save' processes to encourage them not to mutate eg. filesystem state that is shared with the parent process. Change-Id: I027d18cbe4ce519b31c4fc1d3ac46b916d1efc87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165407 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit 9dab5edb90d14ad6f71cc2ac96cc504c1e8c290b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165427 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx3
-rw-r--r--desktop/source/lib/init.cxx8
2 files changed, 10 insertions, 1 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 1a0c2fed27b1..298e5a5d7a9b 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -3594,10 +3594,11 @@ void DesktopLOKTest::testABI()
CPPUNIT_ASSERT_EQUAL(classOffset(18), offsetof(struct _LibreOfficeKitClass, startURP));
CPPUNIT_ASSERT_EQUAL(classOffset(19), offsetof(struct _LibreOfficeKitClass, stopURP));
CPPUNIT_ASSERT_EQUAL(classOffset(20), offsetof(struct _LibreOfficeKitClass, joinThreads));
+ CPPUNIT_ASSERT_EQUAL(classOffset(21), offsetof(struct _LibreOfficeKitClass, setForkedChild));
// When extending LibreOfficeKit with a new function pointer, add new assert for the offsetof the
// new function pointer and bump this assert for the size of the class.
- CPPUNIT_ASSERT_EQUAL(classOffset(21), sizeof(struct _LibreOfficeKitClass));
+ CPPUNIT_ASSERT_EQUAL(classOffset(22), sizeof(struct _LibreOfficeKitClass));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(0), offsetof(struct _LibreOfficeKitDocumentClass, destroy));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(1), offsetof(struct _LibreOfficeKitDocumentClass, saveAs));
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 99c533c20598..cac261e9bcac 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2543,6 +2543,8 @@ static void lo_stopURP(LibreOfficeKit* pThis, void* pSendURPToLOContext);
static int lo_joinThreads(LibreOfficeKit* pThis);
+static void lo_setForkedChild(LibreOfficeKit* pThis, bool bIsChild);
+
static void lo_runLoop(LibreOfficeKit* pThis,
LibreOfficeKitPollCallback pPollCallback,
LibreOfficeKitWakeCallback pWakeCallback,
@@ -2588,6 +2590,7 @@ LibLibreOffice_Impl::LibLibreOffice_Impl()
m_pOfficeClass->startURP = lo_startURP;
m_pOfficeClass->stopURP = lo_stopURP;
m_pOfficeClass->joinThreads = lo_joinThreads;
+ m_pOfficeClass->setForkedChild = lo_setForkedChild;
gOfficeClass = m_pOfficeClass;
}
@@ -3340,6 +3343,11 @@ static int lo_joinThreads(LibreOfficeKit* /* pThis */)
return 1;
}
+static void lo_setForkedChild(LibreOfficeKit* /* pThis */, bool bIsChild)
+{
+ comphelper::LibreOfficeKit::setForkedChild(bIsChild);
+}
+
static void lo_registerCallback (LibreOfficeKit* pThis,
LibreOfficeKitCallback pCallback,
void* pData)