chart2/source/tools/ReferenceSizeProvider.cxx |    3 ++-
 sc/source/filter/excel/xepage.cxx             |    5 +++--
 sfx2/source/doc/guisaveas.cxx                 |   13 ++++++++++---
 3 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 0c80b4440fe3c4a8f14be193136b0903f3b2cd28
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sat Feb 22 08:42:58 2025 -0500
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Apr 9 15:13:56 2025 +0200

    lok: handle saveas as export
    
    SaveAs saves the document to a new path.
    In the jail, this is unhelpful, since
    we upload the document after saving
    from a specific path.
    
    Instead, we do SaveACopy, or export,
    which saves the given document as a
    copy, retaining the original path
    for subsequent saves.
    
    This fixes a serious issue where
    after hitting Ctrl+Shift+S, the
    document would no longer store any
    further changes (in fact, it was
    saving the changes to a different
    path, which was not used for
    uploading).
    
    Signed-off-by: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
    Change-Id: I6ba72df6a0a908d181786c02cb7c060177cd0302
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182071
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit fcf4dd4f09018874ad25a035815f46705db0740a)
    (cherry picked from commit 7bf674d926c22aa81a4d4404dd513a6d71c5b2ee)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183923
    Tested-by: Jenkins

diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 784865a6a7ca..631511eea7be 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1792,8 +1792,12 @@ bool 
SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
     aArgsSequence = aModelData.GetMediaDescr().getAsConstPropertyValueList();
 
     // store the document and handle it's docinfo
-
-    DocumentSettingsGuard aSettingsGuard( aModelData.GetModel(), 
aModelData.IsRecommendReadOnly(), nStoreMode & EXPORT_REQUESTED );
+    // Restore when exporting (which is also done when LoKit is enable, see 
below).
+    const bool bRestore
+        = (nStoreMode & EXPORT_REQUESTED)
+          || ((nStoreMode & SAVEAS_REQUESTED) && 
comphelper::LibreOfficeKit::isActive());
+    DocumentSettingsGuard aSettingsGuard(aModelData.GetModel(), 
aModelData.IsRecommendReadOnly(),
+                                         bRestore);
 
     // Treat attempted PDF export like a print: update document print 
statistics
     if ((nStoreMode & PDFEXPORT_REQUESTED) && SfxViewShell::Current())
@@ -1889,7 +1893,10 @@ bool 
SfxStoringHelper::FinishGUIStoreModel(::comphelper::SequenceAsHashMap::cons
         try
         {
 #endif
-            if ( nStoreMode & EXPORT_REQUESTED )
+            // SaveAs in LoKit is unhelpful. It saves the document to a new 
path, which
+            // breaks the link with the storage, so new modifications can't be 
uploaded.
+            if ((nStoreMode & EXPORT_REQUESTED)
+                || ((nStoreMode & SAVEAS_REQUESTED) && 
comphelper::LibreOfficeKit::isActive()))
                 aModelData.GetStorable()->storeToURL( aURL.GetMainURL( 
INetURLObject::DecodeMechanism::NONE ), aArgsSequence );
             else
                 aModelData.GetStorable()->storeAsURL( aURL.GetMainURL( 
INetURLObject::DecodeMechanism::NONE ), aArgsSequence );
commit 4241af29fad1aba278286d7cbc0a2942eb189cc4
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Feb 23 09:06:31 2025 -0500
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Apr 9 15:13:48 2025 +0200

    sc: filter: check for null Brush
    
    The likely cause of the this crash:
    /opt/collaboraoffice/program/libmergedlo.so(
    SvxBrushItem::GetGraphicObject(rtl::OUString const&) 
const+0x25)[0x7faf881f90e5]
    /opt/collaboraoffice/program/libmergedlo.so(
    SvxBrushItem::GetGraphic(rtl::OUString const&) const+0xd)[0x7faf881f964d]
    /opt/collaboraoffice/program/libscfiltlo.so(+0x1b1dbe)[0x7faf7a32fdbe]
    /opt/collaboraoffice/program/libscfiltlo.so(+0x107371)[0x7faf7a285371]
    
    This was fixed by identifying all the GetGraphic() calls
    on a pointer. This turned out to be the only unprotected
    one in sc/source/filter, where the stack shows.
    
    Signed-off-by: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
    Change-Id: I64175e838423dfeaa4f93762c4894a99236a2ece
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182073
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    (cherry picked from commit 3e146b4c8dcc15bb12ef036162090a0301d6aadf)
    (cherry picked from commit 0d6eefe77ed1b1ac9798f3ad9a215892cce33409)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183922
    Tested-by: Jenkins

diff --git a/sc/source/filter/excel/xepage.cxx 
b/sc/source/filter/excel/xepage.cxx
index 28779bd209a1..06af615d0e56 100644
--- a/sc/source/filter/excel/xepage.cxx
+++ b/sc/source/filter/excel/xepage.cxx
@@ -489,8 +489,9 @@ void XclExpPageSettings::SaveXml( XclExpXmlStream& rStrm )
 
 XclExpImgData* XclExpPageSettings::getGraphicExport()
 {
-    if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
-        return new XclExpImgData( *pGraphic, EXC_ID8_IMGDATA );
+    if( maData.mxBrushItem )
+        if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
+            return new XclExpImgData( *pGraphic, EXC_ID8_IMGDATA );
 
     return nullptr;
 }
commit 52e6adcf470b0b186eaa8bb62c23a5d89648a266
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Feb 23 08:24:25 2025 -0500
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Apr 9 15:13:42 2025 +0200

    chart2: protect against null chart objects in ReferenceSizeProvider
    
    The likely cause of this crash:
    
    /opt/collaboraoffice/program/../program/libchartcorelo.so(
    chart::ReferenceSizeProvider::getAutoResizeState(
        rtl::Reference<chart::ChartModel> const&)+0x87)[0x7f98773>
    /opt/collaboraoffice/program/../program/libchartcorelo.so(
    chart::ReferenceSizeProvider::ReferenceSizeProvider(
        com::sun::star::awt::Size, rtl::Reference<chart::ChartModel> 
const&)+0x2c)[0x7>
    
/opt/collaboraoffice/program/../program/libchartcontrollerlo.so(+0x1fc3ae)[0x7f98769e43ae]
    
/opt/collaboraoffice/program/../program/libchartcontrollerlo.so(+0x1fd3b8)[0x7f98769e53b8]
    
    Although it's not entirely clear that, if the given chart
    is null, a subsequent access wouldn't seg-fault.
    
    Signed-off-by: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
    Change-Id: I16a39436c10adfca7f26e9304fd249efb0a53f8b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182072
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 9aa52c452596db522cd9db616d98b03fe87c74d0)
    (cherry picked from commit ca4e0b62bd814ff1d4f2e707ff658dd4a63cb728)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183921
    Tested-by: Jenkins

diff --git a/chart2/source/tools/ReferenceSizeProvider.cxx 
b/chart2/source/tools/ReferenceSizeProvider.cxx
index 57c2015ad23b..6135724dca5d 100644
--- a/chart2/source/tools/ReferenceSizeProvider.cxx
+++ b/chart2/source/tools/ReferenceSizeProvider.cxx
@@ -224,7 +224,8 @@ ReferenceSizeProvider::AutoResizeState 
ReferenceSizeProvider::getAutoResizeState
     // Main Title
     if( xChartDoc.is())
         impl_getAutoResizeFromTitled( xChartDoc, eResult );
-    if( eResult == AUTO_RESIZE_AMBIGUOUS )
+    if (eResult == AUTO_RESIZE_AMBIGUOUS
+        || eResult == AUTO_RESIZE_UNKNOWN) // Unknown when xChartDoc is null.
         return eResult;
 
     // diagram is needed by the rest of the objects

Reply via email to