diff options
-rw-r--r-- | desktop/source/lib/init.cxx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 41f05517082f..1163ef2a638f 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3817,7 +3817,8 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, { // Text documents have a single coordinate system; don't change part. int nOrigPart = 0; - const bool isText = (doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT); + const int aType = doc_getDocumentType(pThis); + const bool isText = (aType == LOK_DOCTYPE_TEXT); int nViewId = nOrigViewId; int nLastNonEditorView = nViewId; if (!isText) @@ -3853,6 +3854,14 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, doc_setView(pThis, nLastNonEditorView); } + // Disable callbacks while we are painting - after setting the view + if (nViewId != nOrigViewId && nViewId >= 0) + { + const auto handlerIt = pDocument->mpCallbackFlushHandlers.find(nViewId); + if (handlerIt != pDocument->mpCallbackFlushHandlers.end()) + handlerIt->second->disableCallbacks(); + } + nOrigPart = doc_getPart(pThis); if (nPart != nOrigPart) { @@ -3880,6 +3889,13 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, } if (!isText && nViewId != nOrigViewId) { + if (nViewId >= 0) + { + const auto handlerIt = pDocument->mpCallbackFlushHandlers.find(nViewId); + if (handlerIt != pDocument->mpCallbackFlushHandlers.end()) + handlerIt->second->enableCallbacks(); + } + doc_setView(pThis, nOrigViewId); } } |