vcl/source/app/svapp.cxx |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit b1c77f927aced5eeaebd5c17c30efdc1df74c4f9
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Fri May 10 17:13:55 2024 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Fri May 10 21:25:15 2024 +0200

    lok: dumpState should truncate very long JSON messages.
    
    Otherwise we get huge dumps which can overwhelm our logging and hide
    more useful information, and/or the journal can drop them on the ground.
    
    Change-Id: Ie942c70a90a6df60ccd8986444362d622c213e15
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167456
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 8bfcb5e03d66..b3a63cd05a46 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1750,11 +1750,17 @@ void dumpState(rtl::OStringBuffer &rState)
     vcl::Window *pWin = Application::GetFirstTopLevelWindow();
     while (pWin)
     {
-        tools::JsonWriter props;
-        pWin->DumpAsPropertyTree(props);
+        tools::JsonWriter aProps;
+        pWin->DumpAsPropertyTree(aProps);
 
         rState.append("
        Window: ");
-        rState.append(props.finishAndGetAsOString());
+        OString aPropStr = aProps.finishAndGetAsOString();
+        if (aPropStr.getLength() > 256)
+        {
+            rState.append(aPropStr.subView(0, 256));
+            rState.append("...");
+        } else
+            rState.append(aPropStr);
 
         pWin = Application::GetNextTopLevelWindow( pWin );
     }

Reply via email to