summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-17 15:08:35 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-10-17 15:11:03 +0100
commit5718c72ae89fb1a7aa8ee292dc9cb92acbde92db (patch)
tree01a95f6541f93a27cdf7f8cc8837f9fa19045000
parentfbd1c167851a04c60d91daa830cf93e5b2ad7b4d (diff)
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
-rw-r--r--svx/source/sidebar/area/AreaPropertyPanelBase.cxx8
-rw-r--r--svx/source/sidebar/shadow/ShadowPropertyPanel.cxx43
-rw-r--r--svx/source/sidebar/shadow/ShadowPropertyPanel.hxx10
3 files changed, 41 insertions, 20 deletions
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index 4b5b127fe11a..ee40b27472f9 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 36dfb519b9e2..cbb62ade9e93 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 689a9bdfb95b..6b28a252bbe2 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: */