chart2/source/controller/sidebar/ChartAreaPanel.cxx |    2 +-
 cui/source/tabpages/tptrans.cxx                     |    4 ++--
 include/svx/sidebar/AreaPropertyPanelBase.hxx       |    4 ++--
 svx/source/sidebar/area/AreaPropertyPanelBase.cxx   |    7 +++----
 4 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit a608afdb681945c6f65737b9b5387c364163561e
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Dec 8 17:51:39 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue Dec 9 08:20:00 2025 +0100

    ubsan: fix downcast
    
    /svx/source/sidebar/area/AreaPropertyPanelBase.cxx:820:42: runtime error: 
downcast of address 0x5030003750d0 which does not point to an object of type 
'const SfxUInt16Item'
    0x5030003750d0: note: object is of type 'XFillTransparenceItem'
     00 00 00 00  d0 74 21 ac 12 7f 00 00  00 00 00 00 fb 03 be be  15 00 00 00 
89 be 00 00  00 00 00 00
                  ^~~~~~~~~~~~~~~~~~~~~~~
                  vptr for 'XFillTransparenceItem'
        #0 0x7f12b02722cf in svx::sidebar::AreaPropertyPanel
    
    after
      commit 953219b81126f5c092bf5375c0abe2a7afce40d2
      Author: Noel Grandin <[email protected]>
      Date:   Wed Dec 3 21:34:19 2025 +0200
      make XFillTransparenceItem extend SfxPoolItem
    
    Change-Id: Iaee48c5f5522cab8ec48cffd621cc866151429af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195235
    Reviewed-by: Dan Williams <[email protected]>
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx 
b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 036c3ef1e87e..2e29e49c5f17 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -454,7 +454,7 @@ void ChartAreaPanel::updateData()
     {
         sal_uInt16 nFillTransparence = 0;
         xPropSet->getPropertyValue(u"FillTransparence"_ustr) >>= 
nFillTransparence;
-        SfxUInt16Item aTransparenceItem(0, nFillTransparence);
+        XFillTransparenceItem aTransparenceItem(nFillTransparence);
         updateFillTransparence(false, true, &aTransparenceItem);
     }
 
diff --git a/cui/source/tabpages/tptrans.cxx b/cui/source/tabpages/tptrans.cxx
index 6682ff955ca7..d787d087edec 100644
--- a/cui/source/tabpages/tptrans.cxx
+++ b/cui/source/tabpages/tptrans.cxx
@@ -245,11 +245,11 @@ std::unique_ptr<SfxTabPage> 
SvxTransparenceTabPage::Create(weld::Container* pPag
 bool SvxTransparenceTabPage::FillItemSet(SfxItemSet* rAttrs)
 {
     const SfxPoolItem* pGradientItem = nullptr;
-    const SfxPoolItem* pLinearItem = nullptr;
+    const XFillTransparenceItem* pLinearItem = nullptr;
     SfxItemState 
eStateGradient(rOutAttrs.GetItemState(XATTR_FILLFLOATTRANSPARENCE, true, 
&pGradientItem));
     SfxItemState eStateLinear(rOutAttrs.GetItemState(XATTR_FILLTRANSPARENCE, 
true, &pLinearItem));
     bool bGradActive = (eStateGradient == SfxItemState::SET && 
static_cast<const XFillFloatTransparenceItem*>(pGradientItem)->IsEnabled());
-    bool bLinearActive = (eStateLinear == SfxItemState::SET && 
static_cast<const XFillTransparenceItem*>(pLinearItem)->GetValue() != 0);
+    bool bLinearActive = (eStateLinear == SfxItemState::SET && 
pLinearItem->GetValue() != 0);
 
     bool bGradUsed = (eStateGradient == SfxItemState::INVALID);
     bool bLinearUsed = (eStateLinear == SfxItemState::INVALID);
diff --git a/include/svx/sidebar/AreaPropertyPanelBase.hxx 
b/include/svx/sidebar/AreaPropertyPanelBase.hxx
index eca8220a0812..131d53233eca 100644
--- a/include/svx/sidebar/AreaPropertyPanelBase.hxx
+++ b/include/svx/sidebar/AreaPropertyPanelBase.hxx
@@ -91,7 +91,7 @@ public:
     virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const 
XFillBitmapItem& aHatchItem) = 0;
     virtual void setFillUseBackground(const XFillStyleItem* pStyleItem, const 
XFillUseSlideBackgroundItem& rItem) = 0;
 
-    void updateFillTransparence(bool bDisabled, bool bDefaultOrSet, const 
SfxPoolItem* pState);
+    void updateFillTransparence(bool bDisabled, bool bDefaultOrSet, const 
XFillTransparenceItem* pState);
     void updateFillFloatTransparence(bool bDisabled, bool bDefaultOrSet, const 
SfxPoolItem* pState);
     void updateFillStyle(bool bDisabled, bool bDefaultOrSet, const 
SfxPoolItem* pState);
     void updateFillGradient(bool bDisabled, bool bDefaultOrSet, const 
SfxPoolItem* pState);
@@ -154,7 +154,7 @@ protected:
     OUString  maImgLinear;
 
     std::unique_ptr< XFillFloatTransparenceItem >   mpFloatTransparenceItem;
-    std::unique_ptr< SfxUInt16Item >                mpTransparenceItem;
+    std::unique_ptr< XFillTransparenceItem >        mpTransparenceItem;
 
     // MCGR: Preserve ColorStops until we have a UI to edit these
     basegfx::BColorStops maColorStops;
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx 
b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index 373ad4b20397..1cc38dcf4f55 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -806,7 +806,7 @@ void AreaPropertyPanelBase::ImpUpdateTransparencies()
     }
 }
 
-void AreaPropertyPanelBase::updateFillTransparence(bool bDisabled, bool 
bDefaultOrSet, const SfxPoolItem* pState)
+void AreaPropertyPanelBase::updateFillTransparence(bool bDisabled, bool 
bDefaultOrSet, const XFillTransparenceItem* pState)
 {
     if (bDisabled)
     {
@@ -817,8 +817,7 @@ void AreaPropertyPanelBase::updateFillTransparence(bool 
bDisabled, bool bDefault
     {
         if (pState)
         {
-            const SfxUInt16Item* pItem = static_cast<const 
SfxUInt16Item*>(pState);
-            mpTransparenceItem.reset(pItem->Clone());
+            mpTransparenceItem.reset(pState->Clone());
         }
         else
         {
@@ -1089,7 +1088,7 @@ void AreaPropertyPanelBase::NotifyItemUpdate(
     switch(nSID)
     {
         case SID_ATTR_FILL_TRANSPARENCE:
-            updateFillTransparence(bDisabled, bDefaultOrSet, pState);
+            updateFillTransparence(bDisabled, bDefaultOrSet, static_cast<const 
XFillTransparenceItem*>(pState));
         break;
         case SID_ATTR_FILL_FLOATTRANSPARENCE:
             updateFillFloatTransparence(bDisabled, bDefaultOrSet, pState);

Reply via email to