desktop/source/lib/init.cxx |    2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 3d166314525aa86f16a2c8aba76bb796c77589fb
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Sep 16 12:24:20 2025 +0500
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Sep 18 08:50:16 2025 +0200

    LOK: Avoid failed assertion when extracting document structure
    
     coolforkit-ns: /home/mk/core/vcl/source/app/dbggui.cxx:36: void 
ImplDbgTestSolarMutex(bool):
     Assertion `ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() 
&& "SolarMutex not
     owned!"' failed.
    
    Seen with this call stack:
    
     #0  0x00007f71b2b7ee96 in __GI___assert_fail (
         assertion=0x7f71aa2c4de0 
"ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() && \"SolarMutex 
not owned!\"", file=0x7f71aa2c4db8 "/home/mk/core/vcl/source/app/dbggui.cxx", 
line=36,
         function=0x7f71aa2c4d90 "void ImplDbgTestSolarMutex(bool)") at 
./assert/assert.c:103
     #1  0x00007f71a952e69b in ImplDbgTestSolarMutex (owned=true) at 
/home/mk/core/vcl/source/app/dbggui.cxx:36
     #2  0x00007f71ab311ee0 in DbgTestSolarMutex (owned=true) at 
/home/mk/core/tools/source/debug/debug.cxx:54
     #3  0x00007f719ae4156d in SwModify::Add (this=0x55ace7ff8ec0, rDepend=...)
         at /home/mk/core/sw/source/core/attr/calbck.cxx:172
     #4  0x00007f719b42e062 in SwContentNode::SwContentNode 
(this=0x55ace8021f50, rWhere=..., nNdType=SwNodeType::Text, 
pColl=0x55ace7ff8ec0) at /home/mk/core/sw/source/core/docnode/node.cxx:1082
     #5  0x00007f719ba84bee in SwTextNode::SwTextNode (this=0x55ace8021f50, 
rWhere=..., pTextColl=0x55ace7ff8ec0, pAutoAttr=0x0) at 
/home/mk/core/sw/source/core/txtnode/ndtxt.cxx:219
     #6  0x00007f719ba84661 in SwNodes::MakeTextNode (this=0x55ace83b0ee0, 
rWhere=..., pColl=0x55ace7ff8ec0, bNewFrames=true) at 
/home/mk/core/sw/source/core/txtnode/ndtxt.cxx:133
     #7  0x00007f719b442347 in SwNodes::MakeTextSection (this=0x55ace83b0ee0, 
rWhere=..., eSttNdTyp=SwNormalStartNode, pColl=0x55ace7ff8ec0) at 
/home/mk/core/sw/source/core/docnode/nodes.cxx:1953
     #8  0x00007f719b18c9a2 in SwRangeRedline::MoveToSection 
(this=0x55ace8302bd0) at /home/mk/core/sw/source/core/doc/docredln.cxx:1962
     #9  0x00007f719b18b8c8 in SwRangeRedline::ShowOriginal 
(this=0x55ace8302bd0, nLoop=0, nMyPos=3) at 
/home/mk/core/sw/source/core/doc/docredln.cxx:1772
     #10 0x00007f719c650b17 in (anonymous namespace)::HideNewerShowOlder::Hide 
(pRedline=0x55ace8302bd0, rTable=...) at 
/home/mk/core/sw/source/uibase/uno/loktxdoc.cxx:934
     #11 0x00007f719c650668 in (anonymous 
namespace)::HideNewerShowOlder::HideNewerShowOlder (this=0x7ffea7e20b60, 
limit=..., rTable=...) at /home/mk/core/sw/source/uibase/uno/loktxdoc.cxx:885
     #12 0x00007f719c651152 in (anonymous 
namespace)::GetDocStructureTrackChanges (rJsonWriter=..., 
pDocShell=0x55ace7d72d00, filterArguments=...) at 
/home/mk/core/sw/source/uibase/uno/loktxdoc.cxx:997
     #13 0x00007f719c651cc3 in (anonymous namespace)::GetDocStructure 
(rJsonWriter=..., pDocShell=0x55ace7d72d00, rArguments=...) at 
/home/mk/core/sw/source/uibase/uno/loktxdoc.cxx:1077
     #14 0x00007f719c6524a4 in SwXTextDocument::getCommandValues 
(this=0x55ace836de60, rJsonWriter=..., rCommand=...) at 
/home/mk/core/sw/source/uibase/uno/loktxdoc.cxx:1162
     #15 0x00007f71b272492f in lo_extractDocumentStructureRequest 
(pFilePath=0x55ace4085040 "file:///tmp/user/docs/IvJPNWKKqE4D3jXV/works.docx", 
pFilter=0x55ace7b2a450 "trackchanges,contextLen:100") at 
/home/mk/core/desktop/source/lib/init.cxx:3352
     #16 0x000055accb8ae888 in lok::Office::extractDocumentStructureRequest 
(pFilter=<optimized out>, pFilePath=<optimized out>, this=0x55acd7c16bd0) at 
/home/mk/core/include/LibreOfficeKit/LibreOfficeKit.hxx:1301
     #17 ChildSession::_handleInput (this=0x55ace78ead30, buffer=<optimized 
out>, length=<optimized out>) at kit/ChildSession.cpp:371
     #18 0x000055accb95f62c in Session::handleMessage (this=0x55ace78ead30, 
data=...) at common/Session.cpp:326
     #19 0x000055accb901e25 in Document::forwardToChild (this=0x55ace7a662b0, 
prefix=..., payload=...) at kit/Kit.cpp:2283
     #20 0x000055accb902a8e in Document::drainQueue (this=0x55ace7a662b0) at 
/usr/include/c++/13/string_view:146
     #21 0x000055accb9036cd in KitSocketPoll::drainQueue (this=0x55ace7a8c880) 
at kit/Kit.cpp:2961
     #22 KitSocketPoll::kitPoll (this=0x55ace7a8c880, timeoutMicroS=<optimized 
out>) at kit/Kit.cpp:3034
     #23 0x00007f71a99ac661 in SvpSalInstance::ImplYield (this=0x55acd7c35700, 
bWait=true, bHandleAllCurrentEvents=false) at 
/home/mk/core/vcl/headless/svpinst.cxx:463
     #24 0x00007f71a99ac938 in SvpSalInstance::DoYield (this=0x55acd7c35700, 
bWait=true, bHandleAllCurrentEvents=false) at 
/home/mk/core/vcl/headless/svpinst.cxx:504
     #25 0x00007f71a95f88d9 in ImplYield (i_bWait=true, i_bAllEvents=false) at 
/home/mk/core/vcl/source/app/svapp.cxx:389
     #26 0x00007f71a95f9794 in Application::Yield () at 
/home/mk/core/vcl/source/app/svapp.cxx:492
     #27 0x00007f71a95f855a in Application::Execute () at 
/home/mk/core/vcl/source/app/svapp.cxx:364
     #28 0x00007f71b26602a7 in desktop::Desktop::Main (this=0x7ffea7e23f30) at 
/home/mk/core/desktop/source/app/app.cxx:1680
     #29 0x00007f71a96249f1 in ImplSVMain () at 
/home/mk/core/vcl/source/app/svmain.cxx:228
     #30 0x00007f71a9624ad6 in SVMain () at 
/home/mk/core/vcl/source/app/svmain.cxx:246
     #31 0x00007f71b26d300e in soffice_main () at 
/home/mk/core/desktop/source/app/sofficemain.cxx:121
     #32 0x00007f71b2743c40 in lo_runLoop (pPollCallback=0x55accb904070 
<pollCallback(void*, int)>, pWakeCallback=0x55accb8e6ab0 <wakeCallback(void*)>, 
pData=0x55ace7a8c880) at /home/mk/core/desktop/source/lib/init.cxx:7873
     #33 0x000055accb90c3af in lok::Office::runLoop (pData=0x55ace7a8c880, 
pWakeCallback=0x55accb8e6ab0 <wakeCallback(void*)>, 
pPollCallback=0x55accb904070 <pollCallback(void*, int)>, this=0x55acd7c16bd0) 
at /home/mk/core/include/LibreOfficeKit/LibreOfficeKit.hxx:1156
     #34 lokit_main (childRoot=..., jailId=..., configId=..., sysTemplate=..., 
loTemplate=..., noCapabilities=<optimized out>, noSeccomp=<optimized out>, 
useMountNamespaces=<optimized out>, queryVersion=<optimized out>, 
displayVersion=<optimized out>, sysTemplateIncomplete=<optimized out>, 
numericIdentifier=<optimized out>) at kit/Kit.cpp:3926
     #35 0x000055accb8c7ea9 in operator() (__closure=<optimized out>) at 
kit/ForKit.cpp:556
     #36 std::__invoke_impl<void, createLibreOfficeKit(const std::string&, 
const std::string&, const std::string&, const std::string&, bool, 
bool)::<lambda()>&> (__f=...) at /usr/include/c++/13/bits/invoke.h:61
     #37 std::__invoke_r<void, createLibreOfficeKit(const std::string&, const 
std::string&, const std::string&, const std::string&, bool, bool)::<lambda()>&> 
(__fn=...) at /usr/include/c++/13/bits/invoke.h:111
     #38 std::_Function_handler<void(), createLibreOfficeKit(const 
std::string&, const std::string&, const std::string&, const std::string&, bool, 
bool)::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...) at 
/usr/include/c++/13/bits/std_function.h:290
     #39 0x000055accb8cb1c2 in std::function<void ()>::operator()() const 
(this=0x7ffea7e24e90) at /usr/include/c++/13/bits/std_function.h:591
     #40 forkKit(const std::function<void()> &, const std::string &, const 
std::function<void(int)> &) (childFunc=..., childProcessName=..., 
parentFunc=...) at kit/ForKit.cpp:499
     #41 0x000055accb8cc6ef in createLibreOfficeKit (childRoot=..., 
sysTemplate=..., loTemplate=..., useMountNamespaces=<optimized out>, 
queryVersion=<optimized out>, configId=...) at kit/ForKit.cpp:576
     #42 0x000055accb8d1578 in forkit_main (argc=<optimized out>, 
argv=<optimized out>) at kit/ForKit.cpp:1042
     #43 0x00007f71b2b6ed90 in __libc_start_call_main 
(main=main@entry=0x55accb8835a0 <main(int, char**)>, argc=argc@entry=10, 
argv=argv@entry=0x7ffea7e25e58) at ../sysdeps/nptl/libc_start_call_main.h:58
     #44 0x00007f71b2b6ee40 in __libc_start_main_impl (main=0x55accb8835a0 
<main(int, char**)>, argc=10, argv=0x7ffea7e25e58, init=<optimized out>, 
fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffea7e25e48) at 
../csu/libc-start.c:392
     #45 0x000055accb884845 in _start ()
    
    Change-Id: Ib7e8f93b094db925b6bb60134d23aeb325a10f54
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191016
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index eda9965739e7..149b7f1eddbd 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3295,6 +3295,8 @@ static char* lo_extractRequest(LibreOfficeKit* /*pThis*/, 
const char* pFilePath)
 static char* lo_extractDocumentStructureRequest(LibreOfficeKit* /*pThis*/, 
const char* pFilePath,
                                                 const char* pFilter)
 {
+    SolarMutexGuard aGuard;
+
     uno::Reference<frame::XDesktop2> xComponentLoader = 
frame::Desktop::create(xContext);
     uno::Reference< css::lang::XComponent > xComp;
     OUString aURL(getAbsoluteURL(pFilePath));

Reply via email to