[Libreoffice-commits] core.git: svx/source

Caolán McNamara caolanm at redhat.com
Sat Oct 17 07:11:25 PDT 2015


 svx/source/sidebar/area/AreaPropertyPanelBase.cxx |    8 ++--
 svx/source/sidebar/shadow/ShadowPropertyPanel.cxx |   43 ++++++++++++++--------
 svx/source/sidebar/shadow/ShadowPropertyPanel.hxx |   10 ++++-
 3 files changed, 41 insertions(+), 20 deletions(-)

New commits:
commit 5718c72ae89fb1a7aa8ee292dc9cb92acbde92db
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 17 15:08:35 2015 +0100

    afl-eventtesting: first discovered impress crash via event fuzzing
    
    SfxObjectShell::Current can and does return null sometimes
    
    protect this init like the other sidebar example and add missing
    licence header
    
    Change-Id: I15d40c08e8ac37116de7d543c16257c8a8090e8a

diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index 4b5b127..ee40b27 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -254,9 +254,9 @@ IMPL_LINK_NOARG_TYPED(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void)
                 mpMTRAngle->Show();
                 mpToolBoxColor->Hide();
 
-                if(pSh && pSh->GetItem(SID_COLOR_TABLE))
+                const SvxColorListItem* pColorListItem = static_cast<const SvxColorListItem*>(pSh ? pSh->GetItem(SID_COLOR_TABLE) : nullptr);
+                if (pColorListItem)
                 {
-                    const SvxColorListItem aColorListItem(*static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE)));
                     mpLbFillAttr->Enable();
                     mpLbFillGradTo->Enable();
                     mpLbFillGradFrom->Enable();
@@ -265,8 +265,8 @@ IMPL_LINK_NOARG_TYPED(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void)
                     mpLbFillAttr->Clear();
                     mpLbFillGradTo->Clear();
                     mpLbFillGradFrom->Clear();
-                    mpLbFillGradTo->Fill(aColorListItem.GetColorList());
-                    mpLbFillGradFrom->Fill(aColorListItem.GetColorList());
+                    mpLbFillGradTo->Fill(pColorListItem->GetColorList());
+                    mpLbFillGradFrom->Fill(pColorListItem->GetColorList());
 
                     mpLbFillGradFrom->AdaptDropDownLineCountToMaximum();
                     mpLbFillGradTo->AdaptDropDownLineCountToMaximum();
diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx
index 36dfb51..cbb62ad 100644
--- a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx
+++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx
@@ -1,3 +1,11 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
 #include <ShadowPropertyPanel.hxx>
 #include <comphelper/string.hxx>
 #include <sfx2/sidebar/ControlFactory.hxx>
@@ -118,21 +126,24 @@ void ShadowPropertyPanel::dispose()
 
 void ShadowPropertyPanel::Initialize()
 {
-    SfxObjectShell* pDocSh = SfxObjectShell::Current();
-    const SfxPoolItem* pItem = pDocSh->GetItem(SID_COLOR_TABLE);
-    pColorList = static_cast<const SvxColorListItem*>(pItem) ->GetColorList();
-    mpLBShadowColor->Fill(pColorList);
-    mpShowShadow->SetState( TRISTATE_FALSE );
-    mpShowShadow->SetClickHdl( LINK(this, ShadowPropertyPanel, ClickShadowHdl ) );
-    mpShadowTransMetric->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransMetricHdl) );
-    mpLBShadowColor->SetSelectHdl( LINK( this, ShadowPropertyPanel, ModifyShadowColorHdl ) );
-    mpShadowAngle->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) );
-    mpShadowDistance->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) );
-    mpShadowTransSlider->SetRange(Range(0,100));
-    mpShadowTransSlider->SetUpdateMode(true);
-    mpShadowTransSlider->SetSlideHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransSliderHdl) );
-    InsertDistanceValues();
-    InsertAngleValues();
+    SfxObjectShell* pSh = SfxObjectShell::Current();
+
+    const SvxColorListItem* pColorListItem = static_cast<const SvxColorListItem*>(pSh ? pSh->GetItem(SID_COLOR_TABLE) : nullptr);
+    if (pColorListItem)
+    {
+        mpLBShadowColor->Fill(pColorListItem->GetColorList());
+        mpShowShadow->SetState( TRISTATE_FALSE );
+        mpShowShadow->SetClickHdl( LINK(this, ShadowPropertyPanel, ClickShadowHdl ) );
+        mpShadowTransMetric->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransMetricHdl) );
+        mpLBShadowColor->SetSelectHdl( LINK( this, ShadowPropertyPanel, ModifyShadowColorHdl ) );
+        mpShadowAngle->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) );
+        mpShadowDistance->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) );
+        mpShadowTransSlider->SetRange(Range(0,100));
+        mpShadowTransSlider->SetUpdateMode(true);
+        mpShadowTransSlider->SetSlideHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransSliderHdl) );
+        InsertDistanceValues();
+        InsertAngleValues();
+    }
 }
 
 IMPL_LINK_NOARG_TYPED(ShadowPropertyPanel, ClickShadowHdl, Button*, void)
@@ -362,3 +373,5 @@ VclPtr<vcl::Window> ShadowPropertyPanel::Create (
 }
 
 }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx
index 689a9bd..6b28a25 100644
--- a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx
+++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx
@@ -1,3 +1,11 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
 #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_SHADOWPROPERTYPANEL_HXX
 #define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_SHADOWPROPERTYPANEL_HXX
 
@@ -63,7 +71,6 @@ private:
     VclPtr<FixedText>     mpFTColor;
     VclPtr<Slider>        mpShadowTransSlider;
     VclPtr<MetricField>   mpShadowTransMetric;
-    XColorListRef         pColorList;
 
     ::sfx2::sidebar::ControllerItem maShadowController;
     ::sfx2::sidebar::ControllerItem maShadowTransController;
@@ -91,3 +98,4 @@ private:
 
 #endif
 
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list