cui/source/inc/cuitabarea.hxx | 2 cui/source/tabpages/tparea.cxx | 88 +++++++++--------- cui/source/tabpages/tpcolor.cxx | 2 filter/source/xsltdialog/xmlfiltercommon.hxx | 5 - filter/source/xsltdialog/xmlfilterdialogcomponent.cxx | 23 ---- filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 37 +++++-- sw/source/ui/misc/pgfnote.cxx | 5 - vcl/source/control/field.cxx | 4 8 files changed, 79 insertions(+), 87 deletions(-)
New commits: commit b6ce0cd83afaab1bc03f7421745ff752c3459e99 Author: Stephan Bergmann <sberg...@redhat.com> Date: Mon Nov 14 17:40:33 2016 +0100 Avoid unnecessary, wrong downcast ...as reported by -fsanitize=vptr when doing "Format - Paragraph... - Area - Color" in Writer: > cui/source/tabpages/tpcolor.cxx:65:19: runtime error: downcast of address 0x6030009782b0 which does not point to an object of type 'XOutdevItemPool' > 0x6030009782b0: note: object is of type 'SwAttrPool' > 20 01 80 1c 50 e8 e9 85 4d 7f 00 00 e0 28 48 86 4d 7f 00 00 c0 d7 11 00 30 61 00 00 80 29 54 00 > ^~~~~~~~~~~~~~~~~~~~~~~ > vptr for 'SwAttrPool' > #0 0x7f4b047cfd3a in SvxColorTabPage::SvxColorTabPage(vcl::Window*, SfxItemSet const&) cui/source/tabpages/tpcolor.cxx:65:19 > #1 0x7f4b0480ec04 in VclPtr<SvxColorTabPage> VclPtr<SvxColorTabPage>::Create<vcl::Window*&, SfxItemSet const&>(vcl::Window*&, SfxItemSet const&) include/vcl/vclptr.hxx:138:46 > #2 0x7f4b047f8567 in SvxColorTabPage::Create(vcl::Window*, SfxItemSet const*) cui/source/tabpages/tpcolor.cxx:326:12 > #3 0x7f4b0472132a in CreateFillStyleTabPage(unsigned short, vcl::Window*, SfxItemSet const&) cui/source/tabpages/tparea.cxx:319:42 > #4 0x7f4b0471ef8b in SvxAreaTabPage::SelectFillTypeHdl_Impl(Button*) cui/source/tabpages/tparea.cxx:330:41 > #5 0x7f4b047114b3 in SvxAreaTabPage::LinkStubSelectFillTypeHdl_Impl(void*, Button*) cui/source/tabpages/tparea.cxx:323:1 > #6 0x7f4df3eac737 in Link<Button*, void>::Call(Button*) const include/tools/link.hxx:84:45 > #7 0x7f4df3e93bb6 in Button::Click()::$_0::operator()() const vcl/source/control/button.cxx:127:85 Change-Id: I6259b100c535fa81b9f7452db84c22d5b10acb1e diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 71a23a2..c31f57f 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -62,7 +62,7 @@ SvxColorTabPage::SvxColorTabPage(vcl::Window* pParent, const SfxItemSet& rInAttr , pPos( nullptr ) , aXFStyleItem( drawing::FillStyle_SOLID ) , aXFillColorItem( OUString(), Color( COL_BLACK ) ) - , aXFillAttr( static_cast<XOutdevItemPool*>( rInAttrs.GetPool() )) + , aXFillAttr( rInAttrs.GetPool() ) , rXFSet( aXFillAttr.GetItemSet() ) , eCM( ColorModel::RGB ) , m_context(comphelper::getProcessComponentContext()) commit 8c12f8145388a586536b874359ad0bae37ffcc3b Author: Stephan Bergmann <sberg...@redhat.com> Date: Mon Nov 14 13:57:15 2016 +0100 This RES_FRM_SIZE item is apparently SwFormatFrameSize, not SvxSizeItem ...as reported by -fsanitize=vptr when doing "Format - Page..." in Writer (though both types have a Size member at the same location, so didn't cause any real problems): > sw/source/ui/misc/pgfnote.cxx:283:32: runtime error: downcast of address 0x604000e23f50 which does not point to an object of type 'const SvxSizeItem' > 0x604000e23f50: note: object is of type 'SwFormatFrameSize' > 94 01 00 3d 90 ae ee 90 ff 7e 00 00 06 00 00 00 58 00 00 be d0 2f 00 00 00 00 00 00 e0 3d 00 00 > ^~~~~~~~~~~~~~~~~~~~~~~ > vptr for 'SwFormatFrameSize' > #0 0x7efd1c8d01e2 in SwFootNotePage::ActivatePage(SfxItemSet const&) sw/source/ui/misc/pgfnote.cxx:283:32 > #1 0x7efd1c8cbf07 in SwFootNotePage::Reset(SfxItemSet const*) sw/source/ui/misc/pgfnote.cxx:230:5 > #2 0x7f002e149560 in SfxTabDialog::ActivatePageHdl(TabControl*) sfx2/source/dialog/tabdlg.cxx:1117:19 > #3 0x7f002e1400e3 in SfxTabDialog::LinkStubActivatePageHdl(void*, TabControl*) sfx2/source/dialog/tabdlg.cxx:1035:1 > #4 0x7f0008248f37 in Link<TabControl*, void>::Call(TabControl*) const include/tools/link.hxx:84:45 > #5 0x7f0008204caa in TabControl::ActivatePage() vcl/source/control/tabctrl.cxx:1601:19 Change-Id: I73df2438565a7069153b22140197897df810b2aa diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx index 691105f..44f6d03 100644 --- a/sw/source/ui/misc/pgfnote.cxx +++ b/sw/source/ui/misc/pgfnote.cxx @@ -18,6 +18,7 @@ */ #include <cmdid.h> +#include <fmtfsize.hxx> #include <hintids.hxx> #include <svx/dialmgr.hxx> #include <svx/dialogs.hrc> @@ -280,8 +281,8 @@ bool SwFootNotePage::FillItemSet(SfxItemSet *rSet) void SwFootNotePage::ActivatePage(const SfxItemSet& rSet) { - const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(rSet.Get( RES_FRM_SIZE )); - lMaxHeight = rSize.GetSize().Height(); + auto const & rSize = static_cast<SwFormatFrameSize const &>(rSet.Get( RES_FRM_SIZE )); + lMaxHeight = rSize.GetHeight(); const SfxPoolItem* pItem; if( SfxItemState::SET == rSet.GetItemState( rSet.GetPool()->GetWhich( SID_ATTR_PAGE_HEADERSET), false, &pItem ) ) commit f3f71b087d25966d39a4c883bbe0b60b27419119 Author: Stephan Bergmann <sberg...@redhat.com> Date: Fri Nov 11 18:25:37 2016 +0100 Avoid -fsanitize=null ...during CppunitTest_filter_dialogs_test: > filter/source/xsltdialog/xmlfiltersettingsdialog.cxx:1398:20: runtime error: reference binding to null pointer of type 'ResMgr' > #0 0x7f144bf5ab10 in XMLFilterListBox::XMLFilterListBox(vcl::Window*, SvxPathControl*) filter/source/xsltdialog/xmlfiltersettingsdialog.cxx:1398:20 > #1 0x7f144bf7abb8 in VclPtr<XMLFilterListBox> VclPtr<XMLFilterListBox>::Create<VclPtr<VclVBox>&, SvxPathControl*>(VclPtr<VclVBox>&, SvxPathControl*&&) include/vcl/vclptr.hxx:138:46 > #2 0x7f144bf50df8 in SvxPathControl::SvxPathControl(vcl::Window*) filter/source/xsltdialog/xmlfiltersettingsdialog.cxx:1312:20 > #3 0x7f144bf7d487 in VclPtr<SvxPathControl> VclPtr<SvxPathControl>::Create<VclPtr<vcl::Window>&>(VclPtr<vcl::Window>&) include/vcl/vclptr.hxx:138:46 > #4 0x7f144bf56a2f in makeSvxPathControl filter/source/xsltdialog/xmlfiltersettingsdialog.cxx:1378:1 > #5 0x7f14d2060a04 in VclBuilder::makeObject(vcl::Window*, rtl::OString const&, rtl::OString const&, std::__debug::map<rtl::OString, rtl::OString, std::less<rtl::OString>, std::allocator<std::pair<rtl::OString const, rtl::OString> > >&) vcl/source/window/builder.cxx:1793:17 > #6 0x7f14d2078ddb in VclBuilder::insertObject(vcl::Window*, rtl::OString const&, rtl::OString const&, std::__debug::map<rtl::OString, rtl::OString, std::less<rtl::OString>, std::allocator<std::pair<rtl::OString const, rtl::OString> > >&, std::__debug::map<rtl::OString, rtl::OString, std::less<rtl::OString>, std::allocator<std::pair<rtl::OString const, rtl::OString> > >&, std::__debug::map<rtl::OString, rtl::OString, std::less<rtl::OString>, std::allocator<std::pair<rtl::OString const, rtl::OString> > >&) vcl/source/window/builder.cxx:1887:25 > #7 0x7f14d208790a in VclBuilder::handleObject(vcl::Window*, xmlreader::XmlReader&) vcl/source/window/builder.cxx:2856:37 > #8 0x7f14d20215bc in VclBuilder::handleChild(vcl::Window*, xmlreader::XmlReader&) vcl/source/window/builder.cxx:2114:33 > #9 0x7f14d2087bea in VclBuilder::handleObject(vcl::Window*, xmlreader::XmlReader&) vcl/source/window/builder.cxx:2859:17 > #10 0x7f14d20215bc in VclBuilder::handleChild(vcl::Window*, xmlreader::XmlReader&) vcl/source/window/builder.cxx:2114:33 > #11 0x7f14d2087bea in VclBuilder::handleObject(vcl::Window*, xmlreader::XmlReader&) vcl/source/window/builder.cxx:2859:17 > #12 0x7f14d20215bc in VclBuilder::handleChild(vcl::Window*, xmlreader::XmlReader&) vcl/source/window/builder.cxx:2114:33 > #13 0x7f14d200c59a in VclBuilder::VclBuilder(vcl::Window*, rtl::OUString const&, rtl::OUString const&, rtl::OString const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&) vcl/source/window/builder.cxx:206:9 > #14 0x7f1492275862 in ScreenshotTest::dumpDialogToPath(rtl::OString const&) test/source/screenshot_test.cxx:177:24 The existing code apparently depended on any calls to getXSLTDialogResMgr in xmlfiltersettingsdialog.cxx only happening after pXSLTResMgr had been set up in the outer XMLFilterDialogComponent::execute in xmlfilterdialogcomponent.cxx. That is not true when each dialog is opened independently in the screenshot test, so instead just call CreateResMgr on demand wherever needed. Change-Id: I9f6dc7c66d4999137352a8d91665b954f4088085 diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx index 952cd1e..2f65dde 100644 --- a/filter/source/xsltdialog/xmlfiltercommon.hxx +++ b/filter/source/xsltdialog/xmlfiltercommon.hxx @@ -84,11 +84,6 @@ extern std::vector< application_info_impl* >& getApplicationInfos(); extern OUString getApplicationUIName( const OUString& rServiceName ); extern const application_info_impl* getApplicationInfo( const OUString& rServiceName ); -extern ResMgr* getXSLTDialogResMgr(); - -#define RESID(x) ResId(x, *getXSLTDialogResMgr()) -#define RESIDSTR(x) RESID(x).toString() - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index 2baa87a..7d4bb28 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -34,7 +34,6 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <tools/resmgr.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <rtl/instance.hxx> @@ -110,17 +109,6 @@ private: VclPtr<XMLFilterSettingsDialog> mpDialog; }; - -namespace -{ - static ResMgr* pXSLTResMgr = nullptr; -} - -ResMgr* getXSLTDialogResMgr() -{ - return pXSLTResMgr; -} - XMLFilterDialogComponent::XMLFilterDialogComponent( const css::uno::Reference< XComponentContext >& rxContext ) : OComponentHelper( maMutex ), mxContext( rxContext ), @@ -258,12 +246,6 @@ void SAL_CALL XMLFilterDialogComponent::disposing() ::SolarMutexGuard aGuard; mpDialog.disposeAndClear(); - - if (pXSLTResMgr) - { - delete pXSLTResMgr; - pXSLTResMgr = nullptr; - } } @@ -308,11 +290,6 @@ sal_Int16 SAL_CALL XMLFilterDialogComponent::execute( ) throw(RuntimeException, { ::SolarMutexGuard aGuard; - if( nullptr == pXSLTResMgr ) - { - pXSLTResMgr = ResMgr::CreateResMgr( "xsltdlg", Application::GetSettings().GetUILanguageTag() ); - } - if( nullptr == mpDialog ) { Reference< XComponent > xComp( this ); diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index ff1fac9..02b30e9 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include "com/sun/star/ui/dialogs/TemplateDescription.hpp" +#include <tools/resmgr.hxx> #include <tools/urlobj.hxx> #include <svtools/headbar.hxx> #include <unotools/streamwrap.hxx> @@ -31,6 +32,7 @@ #include <osl/file.hxx> #include <o3tl/enumrange.hxx> #include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> #include <vcl/builderfactory.hxx> #include <sfx2/filedlghelper.hxx> #include "svtools/treelistentry.hxx" @@ -38,6 +40,7 @@ #include <rtl/uri.hxx> #include <algorithm> +#include <memory> #include "xmlfilterdialogstrings.hrc" #include "xmlfiltersettingsdialog.hxx" @@ -56,6 +59,19 @@ using namespace com::sun::star::util; using ::rtl::Uri; +namespace { + +std::unique_ptr<ResMgr> getXSLTDialogResMgr() { + return std::unique_ptr<ResMgr>( + ResMgr::CreateResMgr( + "xsltdlg", Application::GetSettings().GetUILanguageTag())); +} + +} + +#define RESID(x) ResId(x, *getXSLTDialogResMgr().get()) +#define RESIDSTR(x) RESID(x).toString() + XMLFilterSettingsDialog::XMLFilterSettingsDialog(vcl::Window* pParent, const css::uno::Reference<css::uno::XComponentContext>& rxContext, Dialog::InitFlag eFlag) @@ -230,7 +246,7 @@ void XMLFilterSettingsDialog::onNew() aTempInfo.maDocumentService = "com.sun.star.text.TextDocument"; // execute XML Filter Dialog - ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResMgr(), mxContext, &aTempInfo ); + ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResMgr().get(), mxContext, &aTempInfo ); if ( aDlg->Execute() == RET_OK ) { // insert the new filter @@ -249,7 +265,7 @@ void XMLFilterSettingsDialog::onEdit() filter_info_impl* pOldInfo = static_cast<filter_info_impl*>(pEntry->GetUserData()); // execute XML Filter Dialog - ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResMgr(), mxContext, pOldInfo ); + ScopedVclPtrInstance< XMLFilterTabDialog > aDlg( this, *getXSLTDialogResMgr().get(), mxContext, pOldInfo ); if ( aDlg->Execute() == RET_OK ) { filter_info_impl* pNewInfo = aDlg->getNewFilterInfo(); @@ -1206,28 +1222,29 @@ std::vector< application_info_impl* >& getApplicationInfos() if( aInfos.empty() ) { - ResId aResId1( STR_APPL_NAME_WRITER, *getXSLTDialogResMgr() ); + auto resmgr = getXSLTDialogResMgr(); + ResId aResId1( STR_APPL_NAME_WRITER, *resmgr.get() ); aInfos.push_back( new application_info_impl( "com.sun.star.text.TextDocument", aResId1, "com.sun.star.comp.Writer.XMLImporter", "com.sun.star.comp.Writer.XMLExporter" ) ); - ResId aResId2( STR_APPL_NAME_CALC, *getXSLTDialogResMgr() ); + ResId aResId2( STR_APPL_NAME_CALC, *resmgr.get() ); aInfos.push_back( new application_info_impl( "com.sun.star.sheet.SpreadsheetDocument", aResId2, "com.sun.star.comp.Calc.XMLImporter", "com.sun.star.comp.Calc.XMLExporter" ) ); - ResId aResId3( STR_APPL_NAME_IMPRESS, *getXSLTDialogResMgr() ); + ResId aResId3( STR_APPL_NAME_IMPRESS, *resmgr.get() ); aInfos.push_back( new application_info_impl( "com.sun.star.presentation.PresentationDocument", aResId3, "com.sun.star.comp.Impress.XMLImporter", "com.sun.star.comp.Impress.XMLExporter" ) ); - ResId aResId4( STR_APPL_NAME_DRAW, *getXSLTDialogResMgr() ); + ResId aResId4( STR_APPL_NAME_DRAW, *resmgr.get() ); aInfos.push_back( new application_info_impl( "com.sun.star.drawing.DrawingDocument", aResId4, @@ -1235,28 +1252,28 @@ std::vector< application_info_impl* >& getApplicationInfos() "com.sun.star.comp.Draw.XMLExporter" ) ); // --- oasis file formats... - ResId aResId5( STR_APPL_NAME_OASIS_WRITER, *getXSLTDialogResMgr() ); + ResId aResId5( STR_APPL_NAME_OASIS_WRITER, *resmgr.get() ); aInfos.push_back( new application_info_impl( "com.sun.star.text.TextDocument", aResId5, "com.sun.star.comp.Writer.XMLOasisImporter", "com.sun.star.comp.Writer.XMLOasisExporter" ) ); - ResId aResId6( STR_APPL_NAME_OASIS_CALC, *getXSLTDialogResMgr() ); + ResId aResId6( STR_APPL_NAME_OASIS_CALC, *resmgr.get() ); aInfos.push_back( new application_info_impl( "com.sun.star.sheet.SpreadsheetDocument", aResId6, "com.sun.star.comp.Calc.XMLOasisImporter", "com.sun.star.comp.Calc.XMLOasisExporter" ) ); - ResId aResId7( STR_APPL_NAME_OASIS_IMPRESS, *getXSLTDialogResMgr() ); + ResId aResId7( STR_APPL_NAME_OASIS_IMPRESS, *resmgr.get() ); aInfos.push_back( new application_info_impl( "com.sun.star.presentation.PresentationDocument", aResId7, "com.sun.star.comp.Impress.XMLOasisImporter", "com.sun.star.comp.Impress.XMLOasisExporter" ) ); - ResId aResId8( STR_APPL_NAME_OASIS_DRAW, *getXSLTDialogResMgr() ); + ResId aResId8( STR_APPL_NAME_OASIS_DRAW, *resmgr.get() ); aInfos.push_back( new application_info_impl( "com.sun.star.drawing.DrawingDocument", aResId8, commit c80ac2ba4a6486e6161e17f9118ba1563b7fc00e Author: Stephan Bergmann <sberg...@redhat.com> Date: Fri Nov 11 18:16:52 2016 +0100 Avoid -fsanitize=signed-integer-overflow ...when doing "Format - Page..." in Writer: > vcl/source/control/field.cxx:621:20: runtime error: signed integer overflow: 9223372036854775807 * 100 cannot be represented in type 'long' > #0 0x7f57787c4868 in NumericFormatter::Normalize(long) const vcl/source/control/field.cxx:621:20 > #1 0x7f578a4608dc in SetFieldUnit(MetricField&, FieldUnit, bool) svtools/source/misc/unitconv.cxx:75:32 > #2 0x7f5488952648 in SvxPageDescPage::SvxPageDescPage(vcl::Window*, SfxItemSet const&) cui/source/tabpages/page.cxx:275:5 > #3 0x7f54889c3ea4 in VclPtr<SvxPageDescPage> VclPtr<SvxPageDescPage>::Create<vcl::Window*&, SfxItemSet const&>(vcl::Window*&, SfxItemSet const&) include/vcl/vclptr.hxx:138:46 > #4 0x7f5488925d27 in SvxPageDescPage::Create(vcl::Window*, SfxItemSet const*) cui/source/tabpages/page.cxx:162:12 > #5 0x7f579ea86df4 in SfxTabDialog::ActivatePageHdl(TabControl*) sfx2/source/dialog/tabdlg.cxx:1085:24 > #6 0x7f579ea800e3 in SfxTabDialog::LinkStubActivatePageHdl(void*, TabControl*) sfx2/source/dialog/tabdlg.cxx:1035:1 > #7 0x7f5778b88f37 in Link<TabControl*, void>::Call(TabControl*) const include/tools/link.hxx:84:45 > #8 0x7f5778b44caa in TabControl::ActivatePage() vcl/source/control/tabctrl.cxx:1601:19 and NumericFormatter::mnMax is still SAL_MAX_INT64 (but will be set to a smaller value a few lines futher down in the SvxPageDescPage ctor). So initialize mnMax to a substantially smaller value (that is still "large", but avoids this kind of overflow), and hope that no code relies on the exact initial value. Change-Id: If3b4db1d20bc59418d1769e9690bc7ecdbf29a50 diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index fe4d60c..ea91c0e 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -504,7 +504,9 @@ void NumericFormatter::ImplInit() mnFieldValue = 0; mnLastValue = 0; mnMin = 0; - mnMax = SAL_MAX_INT64; + mnMax = SAL_MAX_INT32; + // a "large" value substantially smaller than SAL_MAX_INT64, to avoid + // overflow in computations using this "dummy" value mnDecimalDigits = 2; mnType = FORMAT_NUMERIC; mbThousandSep = true; commit 2f0885bb364ba795cdda01a145dd88f1318b99b6 Author: Stephan Bergmann <sberg...@redhat.com> Date: Fri Nov 11 18:10:42 2016 +0100 Avoid -fsanitize=null ...when doing "Format - Page..." in Writer (and eFillType is TRANSPARENT): > cui/source/tabpages/tparea.cxx:331:33: runtime error: reference binding to null pointer of type 'SfxTabPage' > #0 0x7f9f053e936f in SvxAreaTabPage::SelectFillTypeHdl_Impl(Button*) cui/source/tabpages/tparea.cxx:331:9 > #1 0x7f9f053e548c in SvxAreaTabPage::ActivatePage(SfxItemSet const&) cui/source/tabpages/tparea.cxx:157:13 > #2 0x7fa21be01676 in SfxTabDialog::ActivatePageHdl(TabControl*) sfx2/source/dialog/tabdlg.cxx:1126:19 > #3 0x7fa21bdf70e3 in SfxTabDialog::LinkStubActivatePageHdl(void*, TabControl*) sfx2/source/dialog/tabdlg.cxx:1035:1 > #4 0x7fa1f5efff37 in Link<TabControl*, void>::Call(TabControl*) const include/tools/link.hxx:84:45 > #5 0x7fa1f5ebbcaa in TabControl::ActivatePage() vcl/source/control/tabctrl.cxx:1601:19 Change-Id: I279f507038ab4bae1be4f02b6537e6d1aab76348 diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index f58e6cd..dd941f8 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -302,7 +302,7 @@ public: void SetPos( sal_uInt16 nInPos ) { m_nPos = nInPos; } void SetAreaTP( bool* pIn ) { m_pbAreaTP = pIn; } virtual void PageCreated(const SfxAllItemSet& aSet) override; - void CreatePage(sal_Int32 nId, SfxTabPage& pTab); + void CreatePage(sal_Int32 nId, SfxTabPage* pTab); void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; } void SetGrdChgd( ChangeType* pIn ) { m_pnGradientListState = pIn; } void SetHtchChgd( ChangeType* pIn ) { m_pnHatchingListState = pIn; } diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index b89ebae..fdbcfc9 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -334,7 +334,7 @@ IMPL_LINK(SvxAreaTabPage, SelectFillTypeHdl_Impl, Button*, pButton, void) maBox.SelectButton(static_cast<PushButton*>(pButton)); FillType eFillType = static_cast<FillType>(maBox.GetCurrentButtonPos()); m_pFillTabPage.disposeAndReset( CreateFillStyleTabPage(eFillType, m_pFillTab, m_rXFSet) ); - CreatePage( eFillType , *m_pFillTabPage); + CreatePage( eFillType , m_pFillTabPage); } } @@ -362,63 +362,63 @@ void SvxAreaTabPage::PointChanged( vcl::Window* , RectPoint ) { } -void SvxAreaTabPage::CreatePage( sal_Int32 nId, SfxTabPage& pTab ) +void SvxAreaTabPage::CreatePage( sal_Int32 nId, SfxTabPage* pTab ) { if(nId == SOLID ) { - static_cast<SvxColorTabPage&>(pTab).SetColorList( m_pColorList ); - static_cast<SvxColorTabPage&>(pTab).SetPos( &m_nPos ); - static_cast<SvxColorTabPage&>(pTab).SetColorChgd( m_pnColorListState ); - static_cast<SvxColorTabPage&>(pTab).Construct(); - static_cast<SvxColorTabPage&>(pTab).ActivatePage( m_rXFSet ); - static_cast<SvxColorTabPage&>(pTab).Reset(&m_rXFSet); - static_cast<SvxColorTabPage&>(pTab).Show(); + static_cast<SvxColorTabPage*>(pTab)->SetColorList( m_pColorList ); + static_cast<SvxColorTabPage*>(pTab)->SetPos( &m_nPos ); + static_cast<SvxColorTabPage*>(pTab)->SetColorChgd( m_pnColorListState ); + static_cast<SvxColorTabPage*>(pTab)->Construct(); + static_cast<SvxColorTabPage*>(pTab)->ActivatePage( m_rXFSet ); + static_cast<SvxColorTabPage*>(pTab)->Reset(&m_rXFSet); + static_cast<SvxColorTabPage*>(pTab)->Show(); } else if(nId == GRADIENT) { - static_cast<SvxGradientTabPage&>(pTab).SetColorList( m_pColorList ); - static_cast<SvxGradientTabPage&>(pTab).SetGradientList( m_pGradientList ); - static_cast<SvxGradientTabPage&>(pTab).SetPos( &m_nPos ); - static_cast<SvxGradientTabPage&>(pTab).SetGrdChgd( m_pnGradientListState ); - static_cast<SvxGradientTabPage&>(pTab).SetColorChgd( m_pnColorListState ); - static_cast<SvxGradientTabPage&>(pTab).Construct(); - static_cast<SvxGradientTabPage&>(pTab).ActivatePage( m_rXFSet ); - static_cast<SvxGradientTabPage&>(pTab).Reset(&m_rXFSet); - static_cast<SvxGradientTabPage&>(pTab).Show(); + static_cast<SvxGradientTabPage*>(pTab)->SetColorList( m_pColorList ); + static_cast<SvxGradientTabPage*>(pTab)->SetGradientList( m_pGradientList ); + static_cast<SvxGradientTabPage*>(pTab)->SetPos( &m_nPos ); + static_cast<SvxGradientTabPage*>(pTab)->SetGrdChgd( m_pnGradientListState ); + static_cast<SvxGradientTabPage*>(pTab)->SetColorChgd( m_pnColorListState ); + static_cast<SvxGradientTabPage*>(pTab)->Construct(); + static_cast<SvxGradientTabPage*>(pTab)->ActivatePage( m_rXFSet ); + static_cast<SvxGradientTabPage*>(pTab)->Reset(&m_rXFSet); + static_cast<SvxGradientTabPage*>(pTab)->Show(); } else if(nId == HATCH) { - static_cast<SvxHatchTabPage&>(pTab).SetColorList( m_pColorList ); - static_cast<SvxHatchTabPage&>(pTab).SetHatchingList( m_pHatchingList ); - static_cast<SvxHatchTabPage&>(pTab).SetPos(&m_nPos); - static_cast<SvxHatchTabPage&>(pTab).SetHtchChgd( m_pnHatchingListState ); - static_cast<SvxHatchTabPage&>(pTab).SetColorChgd( m_pnColorListState ); - static_cast<SvxHatchTabPage&>(pTab).Construct(); - static_cast<SvxHatchTabPage&>(pTab).ActivatePage( m_rXFSet ); - static_cast<SvxHatchTabPage&>(pTab).Reset(&m_rXFSet); - static_cast<SvxHatchTabPage&>(pTab).Show(); + static_cast<SvxHatchTabPage*>(pTab)->SetColorList( m_pColorList ); + static_cast<SvxHatchTabPage*>(pTab)->SetHatchingList( m_pHatchingList ); + static_cast<SvxHatchTabPage*>(pTab)->SetPos(&m_nPos); + static_cast<SvxHatchTabPage*>(pTab)->SetHtchChgd( m_pnHatchingListState ); + static_cast<SvxHatchTabPage*>(pTab)->SetColorChgd( m_pnColorListState ); + static_cast<SvxHatchTabPage*>(pTab)->Construct(); + static_cast<SvxHatchTabPage*>(pTab)->ActivatePage( m_rXFSet ); + static_cast<SvxHatchTabPage*>(pTab)->Reset(&m_rXFSet); + static_cast<SvxHatchTabPage*>(pTab)->Show(); } else if(nId == BITMAP) { - static_cast<SvxBitmapTabPage&>(pTab).SetBitmapList( m_pBitmapList ); - static_cast<SvxBitmapTabPage&>(pTab).SetPos( &m_nPos ); - static_cast<SvxBitmapTabPage&>(pTab).SetBmpChgd( m_pnBitmapListState ); - static_cast<SvxBitmapTabPage&>(pTab).Construct(); - static_cast<SvxBitmapTabPage&>(pTab).ActivatePage( m_rXFSet ); - static_cast<SvxBitmapTabPage&>(pTab).Reset(&m_rXFSet); - static_cast<SvxBitmapTabPage&>(pTab).Show(); + static_cast<SvxBitmapTabPage*>(pTab)->SetBitmapList( m_pBitmapList ); + static_cast<SvxBitmapTabPage*>(pTab)->SetPos( &m_nPos ); + static_cast<SvxBitmapTabPage*>(pTab)->SetBmpChgd( m_pnBitmapListState ); + static_cast<SvxBitmapTabPage*>(pTab)->Construct(); + static_cast<SvxBitmapTabPage*>(pTab)->ActivatePage( m_rXFSet ); + static_cast<SvxBitmapTabPage*>(pTab)->Reset(&m_rXFSet); + static_cast<SvxBitmapTabPage*>(pTab)->Show(); } else if(nId == PATTERN) { - static_cast<SvxPatternTabPage&>(pTab).SetColorList( m_pColorList ); - static_cast<SvxPatternTabPage&>(pTab).SetPatternList( m_pPatternList ); - static_cast<SvxPatternTabPage&>(pTab).SetPos( &m_nPos ); - static_cast<SvxPatternTabPage&>(pTab).SetPtrnChgd( m_pnPatternListState ); - static_cast<SvxPatternTabPage&>(pTab).SetColorChgd( m_pnColorListState ); - static_cast<SvxPatternTabPage&>(pTab).Construct(); - static_cast<SvxPatternTabPage&>(pTab).ActivatePage( m_rXFSet ); - static_cast<SvxPatternTabPage&>(pTab).Reset( &m_rXFSet ); - static_cast<SvxPatternTabPage&>(pTab).Show(); + static_cast<SvxPatternTabPage*>(pTab)->SetColorList( m_pColorList ); + static_cast<SvxPatternTabPage*>(pTab)->SetPatternList( m_pPatternList ); + static_cast<SvxPatternTabPage*>(pTab)->SetPos( &m_nPos ); + static_cast<SvxPatternTabPage*>(pTab)->SetPtrnChgd( m_pnPatternListState ); + static_cast<SvxPatternTabPage*>(pTab)->SetColorChgd( m_pnColorListState ); + static_cast<SvxPatternTabPage*>(pTab)->Construct(); + static_cast<SvxPatternTabPage*>(pTab)->ActivatePage( m_rXFSet ); + static_cast<SvxPatternTabPage*>(pTab)->Reset( &m_rXFSet ); + static_cast<SvxPatternTabPage*>(pTab)->Show(); } } commit 4622e44812656954cd3cd96671d99db8db6d6fb6 Author: Stephan Bergmann <sberg...@redhat.com> Date: Fri Nov 11 18:01:05 2016 +0100 Avoid -fsanitize=enum ...when doing "Format - Page..." in Writer: > cui/source/tabpages/tparea.cxx:268:12: runtime error: load of value 4294967295, which is not a valid value for type 'FillType' > #0 0x7f89ff653a41 in SvxAreaTabPage::Reset(SfxItemSet const*) cui/source/tabpages/tparea.cxx:268:12 > #1 0x7f8d15524560 in SfxTabDialog::ActivatePageHdl(TabControl*) sfx2/source/dialog/tabdlg.cxx:1117:19 > #2 0x7f8d1551b0e3 in SfxTabDialog::LinkStubActivatePageHdl(void*, TabControl*) sfx2/source/dialog/tabdlg.cxx:1035:1 > #3 0x7f8cef623f37 in Link<TabControl*, void>::Call(TabControl*) const include/tools/link.hxx:84:45 > #4 0x7f8cef5dfcaa in TabControl::ActivatePage() vcl/source/control/tabctrl.cxx:1601:19 Change-Id: I19dd3ed9d362132daa3f3be9fb0e9702a62bdeb0 diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index 1facc7c..b89ebae 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -270,7 +270,7 @@ void SvxAreaTabPage::Reset_Impl( const SfxItemSet* rAttrs ) void SvxAreaTabPage::Reset( const SfxItemSet* rAttrs ) { - FillType eFillType = static_cast<FillType>(maBox.GetCurrentButtonPos()); + auto eFillType = maBox.GetCurrentButtonPos(); switch(eFillType) { case SOLID: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits