cui/source/tabpages/tparea.cxx                     |    7 ++-
 reportdesign/source/ui/report/ReportController.cxx |   44 ++++++++++-----------
 2 files changed, 28 insertions(+), 23 deletions(-)

New commits:
commit 24b641a026d6f99d8f287aabc0a830f37b25888d
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sun Oct 2 19:51:01 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Oct 4 11:20:40 2022 +0200

    tdf#151260: crash in SfxItemPool::SetDefaults 
(reportdesign/ReportController)
    
    + deal with the case when there's no XATTR_FILLUSESLIDEBACKGROUND (like 
here)
    
    Change-Id: I2a4cccc80eea69aa88d45b3485d7f6d4448816e2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140894
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    (cherry picked from commit 07aa8138db9bbaf222f2b7cea12a9f7d0a8192d7)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140886
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index 119d6d154076..bbdb9733a02f 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -238,8 +238,11 @@ DeactivateRC SvxAreaTabPage::DeactivatePage( SfxItemSet* 
_pSet )
             {
                 XFillStyleItem aStyleItem( drawing::FillStyle_NONE );
                 _pSet->Put( aStyleItem );
-                XFillUseSlideBackgroundItem aFillBgItem( false );
-                _pSet->Put( aFillBgItem );
+                if (_pSet->HasItem(XATTR_FILLUSESLIDEBACKGROUND))
+                {
+                    XFillUseSlideBackgroundItem aFillBgItem( false );
+                    _pSet->Put( aFillBgItem );
+                }
             }
             break;
         }
diff --git a/reportdesign/source/ui/report/ReportController.cxx 
b/reportdesign/source/ui/report/ReportController.cxx
index 7f20a0040c6e..82edfba92403 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -150,7 +150,9 @@
 #define RPTUI_ID_START      XATTR_FILL_FIRST - 3
 #define RPTUI_ID_END        XATTR_FILL_FIRST - 2
 #define RPTUI_ID_BRUSH      TypedWhichId<SvxBrushItem>(XATTR_FILL_FIRST - 1)
-#define RPTUI_ID_METRIC     XATTR_FILL_LAST + 1
+/// Note that we deliberately overlap an existing item id, so that we can have 
contiguous item ids for
+/// the static defaults.
+#define RPTUI_ID_METRIC     XATTR_FILL_LAST
 
 using namespace ::com::sun::star;
 using namespace uno;
@@ -2336,26 +2338,26 @@ void OReportController::openPageDialog(const 
uno::Reference<report::XSection>& _
         { SID_PAPER_START,      true },
         { SID_PAPER_END,        true },
         { SID_ATTR_BRUSH,       true },
-        { XATTR_FILLSTYLE,      true },
-        { XATTR_FILLCOLOR,      true },
-        { XATTR_FILLGRADIENT,       true },
-        { XATTR_FILLHATCH,      true },
-        { XATTR_FILLBITMAP,     true },
-        { XATTR_FILLTRANSPARENCE,       true },
-        { XATTR_GRADIENTSTEPCOUNT,      true },
-        { XATTR_FILLBMP_TILE,       true },
-        { XATTR_FILLBMP_POS,        true },
-        { XATTR_FILLBMP_SIZEX,      true },
-        { XATTR_FILLBMP_SIZEY,      true },
-        { XATTR_FILLFLOATTRANSPARENCE,  true },
-        { XATTR_SECONDARYFILLCOLOR,     true },
-        { XATTR_FILLBMP_SIZELOG,        true },
-        { XATTR_FILLBMP_TILEOFFSETX,    true },
-        { XATTR_FILLBMP_TILEOFFSETY,    true },
-        { XATTR_FILLBMP_STRETCH,        true },
-        { XATTR_FILLBMP_POSOFFSETX,     true },
-        { XATTR_FILLBMP_POSOFFSETY,     true },
-        { XATTR_FILLBACKGROUND,     true },
+        { 0,      true }, // XATTR_FILLSTYLE
+        { 0,      true }, // XATTR_FILLCOLOR
+        { 0,       true }, // XATTR_FILLGRADIENT
+        { 0,      true }, // XATTR_FILLHATCH
+        { 0,     true }, // XATTR_FILLBITMAP
+        { 0,       true }, // XATTR_FILLTRANSPARENCE
+        { 0,      true }, // XATTR_GRADIENTSTEPCOUNT
+        { 0,       true }, // XATTR_FILLBMP_TILE
+        { 0,        true }, // XATTR_FILLBMP_POS
+        { 0,      true }, // XATTR_FILLBMP_SIZEX
+        { 0,      true }, // XATTR_FILLBMP_SIZEY
+        { 0,  true }, // XATTR_FILLFLOATTRANSPARENCE
+        { 0,     true }, // XATTR_SECONDARYFILLCOLOR
+        { 0,        true }, // XATTR_FILLBMP_SIZELOG
+        { 0,    true }, // XATTR_FILLBMP_TILEOFFSETX
+        { 0,    true }, // XATTR_FILLBMP_TILEOFFSETY
+        { 0,        true }, // XATTR_FILLBMP_STRETCH
+        { 0,     true }, // XATTR_FILLBMP_POSOFFSETX
+        { 0,     true }, // XATTR_FILLBMP_POSOFFSETY
+        { 0,     true }, // XATTR_FILLBACKGROUND
         { SID_ATTR_METRIC,      true }
     };
 

Reply via email to