[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jan 12 10:14:34 UTC 2021
svx/source/tbxctrls/fillctrl.cxx | 38 ++++++++++++++++++++++----------------
1 file changed, 22 insertions(+), 16 deletions(-)
New commits:
commit d03a684439c29137beb4ee3120ded04828935d7b
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jan 11 10:50:59 2021 +0000
Commit: Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Tue Jan 12 11:14:11 2021 +0100
rhbz#1913070 null deref
its plausible that SfxViewFrame::Current() has returned null, use
pSh->GetDispatcher() instead protected by null check against pSh
Change-Id: Ibefdcabea09cb3a1a411678585af33a99f8a1c61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109085
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index 588e77f07439..be8f0f5922db 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -690,10 +690,13 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillTypeHdl, weld::ComboBox&, void)
mpToolBoxColor->hide();
mpLbFillAttr->set_sensitive(false);
- // #i122676# need to call a single SID_ATTR_FILL_STYLE change
- SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
- SID_ATTR_FILL_STYLE, SfxCallMode::RECORD,
- { &aXFillStyleItem });
+ if (pSh)
+ {
+ // #i122676# need to call a single SID_ATTR_FILL_STYLE change
+ pSh->GetDispatcher()->ExecuteList(
+ SID_ATTR_FILL_STYLE, SfxCallMode::RECORD,
+ { &aXFillStyleItem });
+ }
break;
}
case drawing::FillStyle_SOLID:
@@ -704,10 +707,13 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillTypeHdl, weld::ComboBox&, void)
const ::Color aColor = mpColorItem->GetColorValue();
const XFillColorItem aXFillColorItem( aTmpStr, aColor );
- // #i122676# change FillStyle and Color in one call
- SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
- SID_ATTR_FILL_COLOR, SfxCallMode::RECORD,
- { &aXFillColorItem, &aXFillStyleItem });
+ if (pSh)
+ {
+ // #i122676# change FillStyle and Color in one call
+ pSh->GetDispatcher()->ExecuteList(
+ SID_ATTR_FILL_COLOR, SfxCallMode::RECORD,
+ { &aXFillColorItem, &aXFillStyleItem });
+ }
break;
}
case drawing::FillStyle_GRADIENT:
@@ -734,7 +740,7 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillTypeHdl, weld::ComboBox&, void)
const XFillGradientItem aXFillGradientItem(mpLbFillAttr->get_text(mnLastPosGradient), aGradient);
// #i122676# change FillStyle and Gradient in one call
- SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
+ pSh->GetDispatcher()->ExecuteList(
SID_ATTR_FILL_GRADIENT, SfxCallMode::RECORD,
{ &aXFillGradientItem, &aXFillStyleItem });
mpLbFillAttr->set_active(mnLastPosGradient);
@@ -771,7 +777,7 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillTypeHdl, weld::ComboBox&, void)
const XFillHatchItem aXFillHatchItem(mpLbFillAttr->get_active_text(), aHatch);
// #i122676# change FillStyle and Hatch in one call
- SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
+ pSh->GetDispatcher()->ExecuteList(
SID_ATTR_FILL_HATCH, SfxCallMode::RECORD,
{ &aXFillHatchItem, &aXFillStyleItem });
mpLbFillAttr->set_active(mnLastPosHatch);
@@ -808,7 +814,7 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillTypeHdl, weld::ComboBox&, void)
const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->get_active_text(), pXBitmapEntry->GetGraphicObject());
// #i122676# change FillStyle and Bitmap in one call
- SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
+ pSh->GetDispatcher()->ExecuteList(
SID_ATTR_FILL_BITMAP, SfxCallMode::RECORD,
{ &aXFillBitmapItem, &aXFillStyleItem });
mpLbFillAttr->set_active(mnLastPosBitmap);
@@ -843,10 +849,10 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillAttrHdl, weld::ComboBox&, void)
{
case drawing::FillStyle_SOLID:
{
- if(bFillStyleChange)
+ if (bFillStyleChange && pSh)
{
// #i122676# Single FillStyle change call needed here
- SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
+ pSh->GetDispatcher()->ExecuteList(
SID_ATTR_FILL_STYLE, SfxCallMode::RECORD,
{ &aXFillStyleItem });
}
@@ -871,7 +877,7 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillAttrHdl, weld::ComboBox&, void)
const XFillGradientItem aXFillGradientItem(mpLbFillAttr->get_active_text(), aGradient);
// #i122676# Change FillStyle and Gradient in one call
- SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
+ pSh->GetDispatcher()->ExecuteList(
SID_ATTR_FILL_GRADIENT, SfxCallMode::RECORD,
bFillStyleChange
? std::initializer_list<SfxPoolItem const*>{ &aXFillGradientItem, &aXFillStyleItem }
@@ -904,7 +910,7 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillAttrHdl, weld::ComboBox&, void)
const XFillHatchItem aXFillHatchItem( mpLbFillAttr->get_active_text(), aHatch);
// #i122676# Change FillStyle and Hatch in one call
- SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
+ pSh->GetDispatcher()->ExecuteList(
SID_ATTR_FILL_HATCH, SfxCallMode::RECORD,
bFillStyleChange
? std::initializer_list<SfxPoolItem const*>{ &aXFillHatchItem, &aXFillStyleItem }
@@ -937,7 +943,7 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillAttrHdl, weld::ComboBox&, void)
const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->get_active_text(), pXBitmapEntry->GetGraphicObject());
// #i122676# Change FillStyle and Bitmap in one call
- SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
+ pSh->GetDispatcher()->ExecuteList(
SID_ATTR_FILL_BITMAP, SfxCallMode::RECORD,
bFillStyleChange
? std::initializer_list<SfxPoolItem const*>{ &aXFillBitmapItem, &aXFillStyleItem }
More information about the Libreoffice-commits
mailing list