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

New commits:
commit 7b61926fd6704dd244682a965c17e7141ffc1fc5
Author:     Michael Meeks <[email protected]>
AuthorDate: Fri May 10 17:13:55 2024 +0100
Commit:     Noel Grandin <[email protected]>
CommitDate: Sat May 11 14:51:38 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/+/167488
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 79b8f5873df8..34b2774995f1 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1758,11 +1758,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