sfx2/source/doc/objmisc.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 71aa5352f6f57283d1db51c980f6f0b802381871
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Jan 23 12:58:10 2025 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Jan 23 19:39:23 2025 +0100

    sfx2: fix uncaught exception in SfxObjectShell::isEditDocLocked()
    
    Crashreport signature:
    
    SIG   Fatal signal received: SIGABRT code: 18446744073709551610 for 
address: 0x1da00001e2c
    program/libmergedlo.so
            Scheduler::CallbackTaskScheduling()
                    vcl/source/app/scheduler.cxx:486 (discriminator 7)
    program/libmergedlo.so
            comphelper::SolarMutex::release(bool)
                    include/comphelper/solarmutex.hxx:91
    program/libmergedlo.so
            SvpSalInstance::ImplYield(bool, bool)
                    vcl/headless/svpinst.cxx:401
    program/libmergedlo.so
            SvpSalInstance::DoYield(bool, bool)
                    vcl/headless/svpinst.cxx:475
    
    I.e. we do an abort when a task throws when the scheduler processes
    events on the main loop. This happens *sometimes* locally, but it's
    unclear to me how to reliably trigger it. When it happens, we warn like
    this:
    
    warn:vcl.schedule:27650:27441:vcl/source/app/scheduler.cxx:485: Uncaught 
com.sun.star.lang.NotInitializedException message: "at 
sfx2/source/doc/sfxbasemodel.cxx:3034" context: SdXImpressDocument
    
    Checking the SAL_DEBUG_BACKTRACE() output for the case when
    SfxBaseModel::MethodEntryCheck() throws:
    
            #3 instdir/program/libsfxlo.so(SfxBaseModel::MethodEntryCheck(bool) 
const+0x154) [0x7fec1e8ad9b4]
            #4 instdir/program/libsfxlo.so(+0x6bdd1e) [0x7fec1e8bdd1e]
            #5 
instdir/program/libsfxlo.so(SfxBaseModel::getArgs2(com::sun::star::uno::Sequence<rtl::OUString>
 const&)+0x56) [0x7fec1e8a0dd2]
            #6 instdir/program/libsfxlo.so(SfxObjectShell::isEditDocLocked() 
const+0x11c) [0x7fec1e8239da]
            #7 instdir/program/libsfxlo.so(+0x882851) [0x7fec1ea82851]
            #8 instdir/program/libsfxlo.so(+0x87cefc) [0x7fec1ea7cefc]
            #9 
instdir/program/libsfxlo.so(SfxDispatcher::FillState_(SfxSlotServer const&, 
SfxItemSet&, SfxSlot const*)+0x1cc) [0x7fec1e4d57f4]
            #10 instdir/program/libsfxlo.so(+0x2b900a) [0x7fec1e4b900a]
            #11 instdir/program/libsfxlo.so(+0x2bd954) [0x7fec1e4bd954]
            #12 instdir/program/libsfxlo.so(+0x2bd631) [0x7fec1e4bd631]
            #13 instdir/program/libsfxlo.so(+0x2bd5a1) [0x7fec1e4bd5a1]
            #14 instdir/program/libvcllo.so(+0xf4fb91) [0x7fec1894fb91]
            #15 instdir/program/libvcllo.so(Timer::Invoke()+0x23) 
[0x7fec1894fa19]
            #16 
instdir/program/libvcllo.so(Scheduler::CallbackTaskScheduling()+0x123d) 
[0x7fec188fe277]
    
    Fix this in SfxObjectShell::isEditDocLocked(), where we already return
    false to avoid a nullptr dereference, and do it the way
    SfxObjectShell::isScriptAccessAllowed() does the same for consistency.
    
    Change-Id: I435b2877b1b600e01bf32b44bfa664be1672c231
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180663
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index a8005cab97e0..7d48d40a7439 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -2019,7 +2019,15 @@ bool SfxObjectShell::isEditDocLocked() const
     if (officecfg::Office::Common::Misc::ViewerAppMode::get()
         || !officecfg::Office::Common::Misc::AllowEditReadonlyDocs::get())
         return true;
-    return comphelper::NamedValueCollection::getOrDefault(xModel->getArgs2( { 
u"LockEditDoc"_ustr } ), u"LockEditDoc", false);
+    try
+    {
+        return 
comphelper::NamedValueCollection::getOrDefault(xModel->getArgs2( { 
u"LockEditDoc"_ustr } ), u"LockEditDoc", false);
+    }
+    catch (const uno::RuntimeException&)
+    {
+        TOOLS_WARN_EXCEPTION("sfx.appl", "unexpected RuntimeException");
+    }
+    return false;
 }
 
 bool SfxObjectShell::isContentExtractionLocked() const

Reply via email to