Files
ElyOffice/patches/libreoffice/0043-lok-callbacks-flush-inline-everywhere.patch
T
ZacharyZhang-NYandClaude Opus 5.5 c96d39a342 LOK runs on Windows and Linux; packaging stages engines (W-01, K-01)
The kernel is the merged library on every platform; Windows and
Linux find it beside the app in libreoffice/program. All three run
unipoll: macOS through GCD, Linux by answering one request per poll,
Windows through a message-only window on the loop's thread (LOK's
own main thread had deadlocked Calc loads). Patch 0043 flushes
callbacks inline everywhere, so a request sees its result; 0042 stops
MSVC's Boost auto-link. Linux paints with cairo, BGRA; the start-up
check now paints red text and finds red in byte two on every
platform, since getTileMode does not see Skia.

ely-lok on Windows: 180 of 189 pass; on Linux 187. The rest are
listed after 0.1.3 (spelling, Calc dark tiles, show layers and
fields, a11y selection). Tests build file URLs portably and accept
CRLF where Windows writes it.

packaging/stage.sh lays out an app with its engines for Windows and
Linux; licenses.sh finds each licence on all three. ElyMark finds its
page beside the app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 18:27:53 -04:00

94 lines
3.1 KiB
Diff

LOK: callbacks flush inline on every platform
0001 made the callback queue flush inline on macOS, where Aqua never
runs posted user events. Elsewhere scheduleFlush posted a user event,
so a callback reached the client only after the next turn of the
main loop. Ely's worker posts a command and waits for its result and
states inside the same request, which runs inside that loop (unipoll
on Linux, a window message on Windows): the result never came. The
queue now flushes inline everywhere; the flush event, its link and
stop() are gone.
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 76a02127d..39b72fb1a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1609,7 +1609,6 @@ extern "C" {
CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitDocument* pDocument, LibreOfficeKitCallback pCallback, void* pData)
: m_pDocument(pDocument),
m_pCallback(pCallback),
- m_pFlushEvent(nullptr),
m_pData(pData),
m_nDisableCallbacks(0)
{
@@ -1638,18 +1637,8 @@ CallbackFlushHandler::CallbackFlushHandler(LibreOfficeKitDocument* pDocument, Li
}
}
-void CallbackFlushHandler::stop()
-{
- if (m_pFlushEvent)
- {
- Application::RemoveUserEvent(m_pFlushEvent);
- m_pFlushEvent = nullptr;
- }
-}
-
CallbackFlushHandler::~CallbackFlushHandler()
{
- stop();
}
CallbackFlushHandler::queue_type2::iterator CallbackFlushHandler::toQueue2(CallbackFlushHandler::queue_type1::iterator pos)
@@ -2600,23 +2589,11 @@ void CallbackFlushHandler::invoke()
m_queue1.clear();
m_queue2.clear();
- stop();
}
void CallbackFlushHandler::scheduleFlush()
{
-#if defined(MACOSX)
- // Aqua never runs posted user events: flush inline.
- invoke();
-#else
- if (!m_pFlushEvent)
- m_pFlushEvent = Application::PostUserEvent(LINK(this, CallbackFlushHandler, FlushQueue));
-#endif
-}
-
-IMPL_LINK_NOARG(CallbackFlushHandler, FlushQueue, void*, void)
-{
- m_pFlushEvent = nullptr;
+ // Ely's worker waits on callbacks inside a request: flush inline.
invoke();
}
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index 51d690307..6c21850fc 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -210,8 +210,6 @@ namespace desktop {
void enqueueUpdatedTypes();
void enqueueUpdatedType( int type, const SfxViewShell* sourceViewShell, int viewId );
- void stop();
-
/** we frequently want to scan the queue, and mostly when we do so, we only care about the element type
so we split the queue in 2 to make the scanning cache friendly. */
queue_type1 m_queue1;
@@ -246,12 +244,9 @@ namespace desktop {
OString m_aViewRenderState;
int m_viewId = -1; // view id of the associated SfxViewShell
LibreOfficeKitCallback m_pCallback;
- ImplSVEvent* m_pFlushEvent;
void *m_pData;
int m_nDisableCallbacks;
std::recursive_mutex m_mutex;
-
- DECL_LINK(FlushQueue, void*, void);
};
struct DESKTOP_DLLPUBLIC LibLODocument_Impl : public _LibreOfficeKitDocument