diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-01-11 10:50:59 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-01-12 14:40:32 +0100 |
commit | 13430459aef6384895b2ab0eec88173f2140a690 (patch) | |
tree | 09f89e15c3f06d92613a89d06678c11e75b9b25a /svx | |
parent | b345a2bab0d6f981049951a86b172ce49ce7d4c2 (diff) |
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/+/109084
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/fillctrl.cxx | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index 99cc2401235e..7a6cf136d99d 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -686,11 +686,13 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillTypeHdl, weld::ComboBox&, void) mpLbFillAttr->show(); 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: @@ -699,11 +701,13 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillTypeHdl, weld::ComboBox&, void) mpToolBoxColor->show(); const ::Color aColor = mpColorItem->GetColorValue(); const XFillColorItem aXFillColorItem( "", 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: @@ -730,7 +734,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); @@ -767,7 +771,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); @@ -804,7 +808,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); @@ -838,10 +842,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 }); } @@ -866,7 +870,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 } @@ -899,7 +903,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 } @@ -932,7 +936,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 } |