From 4dde0d06bdc00c3783cfe94e8f918a8913274c4e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 20 Oct 2019 15:55:23 +0100 Subject: cid#1453991 Wrapper object use after free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4ea3ed40deaf20e91e1a0a42ee115cf761853875 Reviewed-on: https://gerrit.libreoffice.org/81170 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx | 6 ++++-- dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx | 6 +++--- dbaccess/source/ui/dlg/dbwizsetup.cxx | 8 ++++++-- dbaccess/source/ui/inc/dbwizsetup.hxx | 2 ++ 4 files changed, 15 insertions(+), 7 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx index 5172e0126e65..98c5b890252a 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx @@ -53,6 +53,7 @@ #include "finteraction.hxx" #include #include +#include #include "TextConnectionHelper.hxx" #include @@ -219,12 +220,12 @@ using namespace ::com::sun::star; OGenericAdministrationPage::callModifiedHdl(); } - std::unique_ptr OMySQLIntroPageSetup::CreateMySQLIntroTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet) + std::unique_ptr OMySQLIntroPageSetup::CreateMySQLIntroTabPage(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& rAttrSet) { return std::make_unique(pPage, pController, rAttrSet); } - OMySQLIntroPageSetup::OMySQLIntroPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs) + OMySQLIntroPageSetup::OMySQLIntroPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rCoreAttrs) : OGenericAdministrationPage(pPage, pController, "dbaccess/ui/dbwizmysqlintropage.ui", "DBWizMysqlIntroPage", _rCoreAttrs) , m_xODBCDatabase(m_xBuilder->weld_radio_button("odbc")) , m_xJDBCDatabase(m_xBuilder->weld_radio_button("jdbc")) @@ -233,6 +234,7 @@ using namespace ::com::sun::star; m_xODBCDatabase->connect_toggled(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected)); m_xJDBCDatabase->connect_toggled(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected)); m_xNATIVEDatabase->connect_toggled(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected)); + pController->SetIntroPage(this); } OMySQLIntroPageSetup::~OMySQLIntroPageSetup() diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx index 422500e19938..d8715bdcf984 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx @@ -31,8 +31,8 @@ #include namespace dbaui - { + class ODbTypeWizDialogSetup; // OSpreadSheetConnectionPageSetup class OSpreadSheetConnectionPageSetup final : public OConnectionTabPageSetup @@ -197,10 +197,10 @@ namespace dbaui VIA_NATIVE }; - OMySQLIntroPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs); + OMySQLIntroPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& rCoreAttrs); virtual ~OMySQLIntroPageSetup() override; - static std::unique_ptr CreateMySQLIntroTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet); + static std::unique_ptr CreateMySQLIntroTabPage(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& rAttrSet); ConnectionType getMySQLMode() const; void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; } diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index a68ec099e218..e85971a64cb1 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -446,6 +446,12 @@ void ODbTypeWizDialogSetup::clearPassword() m_pImpl->clearPassword(); } +void ODbTypeWizDialogSetup::SetIntroPage(OMySQLIntroPageSetup* pPage) +{ + m_pMySQLIntroPage = pPage; + m_pMySQLIntroPage->SetClickHdl(LINK( this, ODbTypeWizDialogSetup, ImplClickHdl ) ); +} + std::unique_ptr ODbTypeWizDialogSetup::createPage(WizardState _nState) { std::unique_ptr xPage; @@ -515,8 +521,6 @@ std::unique_ptr ODbTypeWizDialogSetup::createPage(WizardState _nSta break; case PAGE_DBSETUPWIZARD_MYSQL_INTRO: xPage = OMySQLIntroPageSetup::CreateMySQLIntroTabPage(pPageContainer, this, *m_pOutSet); - m_pMySQLIntroPage = static_cast(xPage.get()); - m_pMySQLIntroPage->SetClickHdl(LINK( this, ODbTypeWizDialogSetup, ImplClickHdl ) ); break; case PAGE_DBSETUPWIZARD_AUTHENTIFICATION: diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx index ce23ef6f80cb..c130882139ec 100644 --- a/dbaccess/source/ui/inc/dbwizsetup.hxx +++ b/dbaccess/source/ui/inc/dbwizsetup.hxx @@ -122,6 +122,8 @@ public: */ bool IsTableWizardToBeStarted() const; + void SetIntroPage(OMySQLIntroPageSetup* pPage); + private: /// to override to create new pages virtual std::unique_ptr createPage(WizardState _nState) override; -- cgit