desktop/source/lib/init.cxx |   49 ++++++++++++++++++++++----------------------
 1 file changed, 25 insertions(+), 24 deletions(-)

New commits:
commit dc6cab7dc25ef102a5f010f10d5e7fd30e9d5aaf
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Jul 22 17:18:19 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Jul 23 09:47:15 2025 +0200

    split out block as 'flushBufferedVOCs' for clarity
    
    Change-Id: Iad5311722a2a8ef1a10a8cd5196543841081f368
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188187
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ce25145c9604..cc507d5dfcfd 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3361,6 +3361,30 @@ enum class JoinThreads
 
 static int joinThreads(JoinThreads eCategory);
 
+static void flushBufferedVOCs()
+{
+    // Flush all buffered VOC primitives from the pages.
+    SfxViewShell* pViewShell = SfxViewShell::Current();
+    if (!pViewShell)
+        return;
+    const SdrView* pView = pViewShell->GetDrawView();
+    if (!pView)
+        return;
+    SdrPageView* pPageView = pView->GetSdrPageView();
+    if (!pPageView)
+        return;
+    SdrPage* pCurPage = pPageView->GetPage();
+    if (!pCurPage)
+        return;
+    SdrModel& sdrModel = pCurPage->getSdrModelFromSdrPage();
+    for (sal_uInt16 i = 0; i < sdrModel.GetPageCount(); ++i)
+    {
+        SdrPage* pPage = sdrModel.GetPage(i);
+        if (pPage)
+            pPage->GetViewContact().flushViewObjectContacts();
+    }
+}
+
 static void lo_trimMemory(LibreOfficeKit* /* pThis */, int nTarget)
 {
     SolarMutexGuard aGuard;
@@ -3369,30 +3393,7 @@ static void lo_trimMemory(LibreOfficeKit* /* pThis */, 
int nTarget)
 
     if (nTarget > 2000)
     {
-        // Flush all buffered VOC primitives from the pages.
-        SfxViewShell* pViewShell = SfxViewShell::Current();
-        if (pViewShell)
-        {
-            const SdrView* pView = pViewShell->GetDrawView();
-            if (pView)
-            {
-                SdrPageView* pPageView = pView->GetSdrPageView();
-                if (pPageView)
-                {
-                    SdrPage* pCurPage = pPageView->GetPage();
-                    if (pCurPage)
-                    {
-                        SdrModel& sdrModel = 
pCurPage->getSdrModelFromSdrPage();
-                        for (sal_uInt16 i = 0; i < sdrModel.GetPageCount(); 
++i)
-                        {
-                            SdrPage* pPage = sdrModel.GetPage(i);
-                            if (pPage)
-                                
pPage->GetViewContact().flushViewObjectContacts();
-                        }
-                    }
-                }
-            }
-        }
+        flushBufferedVOCs();
 
         // When more aggressively reclaiming memory then shutdown threads which
         // will restart on demand.

Reply via email to