summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-10-20 18:22:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-10-20 21:15:37 +0200
commitc02c1c2eee57ebf2da29605f62a366720624cb9e (patch)
treeb74afd96d93718d7e00cc3ec51f6d8d71abc3872 /dbaccess
parente49b1917dde9f573fefc3b669c6820f51e96497f (diff)
cid#1453991 Wrapper object use after free
Change-Id: I6476c765589cbb3996ad8832a0e159aa4d965d32 Reviewed-on: https://gerrit.libreoffice.org/81173 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx5
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx4
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx20
-rw-r--r--dbaccess/source/ui/dlg/generalpage.cxx5
-rw-r--r--dbaccess/source/ui/dlg/generalpage.hxx4
-rw-r--r--dbaccess/source/ui/inc/dbwizsetup.hxx2
6 files changed, 28 insertions, 12 deletions
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index 98c5b890252a..42bfc5c88079 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -722,12 +722,12 @@ using namespace ::com::sun::star;
return bChangedSomething;
}
- std::unique_ptr<OGenericAdministrationPage> OFinalDBPageSetup::CreateFinalDBTabPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet)
+ std::unique_ptr<OGenericAdministrationPage> OFinalDBPageSetup::CreateFinalDBTabPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rAttrSet)
{
return std::make_unique<OFinalDBPageSetup>(pPage, pController, _rAttrSet);
}
- OFinalDBPageSetup::OFinalDBPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs)
+ OFinalDBPageSetup::OFinalDBPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rCoreAttrs)
: OGenericAdministrationPage(pPage, pController, "dbaccess/ui/finalpagewizard.ui", "PageFinal", _rCoreAttrs)
, m_xFTFinalHeader(m_xBuilder->weld_label("headerText"))
, m_xFTFinalHelpText(m_xBuilder->weld_label("helpText"))
@@ -741,6 +741,7 @@ using namespace ::com::sun::star;
m_xCBOpenAfterwards->connect_toggled(LINK(this, OFinalDBPageSetup, OnOpenSelected));
m_xCBStartTableWizard->connect_toggled(LINK(this,OGenericAdministrationPage,OnControlModifiedButtonClick));
m_xRBRegisterDataSource->set_active(true);
+ pController->SetFinalPage(this);
}
OFinalDBPageSetup::~OFinalDBPageSetup()
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index d8715bdcf984..9c3f5cb47a17 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -245,9 +245,9 @@ namespace dbaui
{
public:
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override;
- static std::unique_ptr<OGenericAdministrationPage> CreateFinalDBTabPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet);
+ static std::unique_ptr<OGenericAdministrationPage> CreateFinalDBTabPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rAttrSet);
- OFinalDBPageSetup(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs);
+ OFinalDBPageSetup(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rCoreAttrs);
virtual ~OFinalDBPageSetup() override;
bool IsDatabaseDocumentToBeRegistered() const;
bool IsDatabaseDocumentToBeOpened() const;
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index e85971a64cb1..5ddc06b33fd0 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -452,6 +452,20 @@ void ODbTypeWizDialogSetup::SetIntroPage(OMySQLIntroPageSetup* pPage)
m_pMySQLIntroPage->SetClickHdl(LINK( this, ODbTypeWizDialogSetup, ImplClickHdl ) );
}
+void ODbTypeWizDialogSetup::SetGeneralPage(OGeneralPageWizard* pPage)
+{
+ m_pGeneralPage = pPage;
+ m_pGeneralPage->SetTypeSelectHandler(LINK(this, ODbTypeWizDialogSetup, OnTypeSelected));
+ m_pGeneralPage->SetCreationModeHandler(LINK( this, ODbTypeWizDialogSetup, OnChangeCreationMode ) );
+ m_pGeneralPage->SetDocumentSelectionHandler(LINK( this, ODbTypeWizDialogSetup, OnRecentDocumentSelected ) );
+ m_pGeneralPage->SetChooseDocumentHandler(LINK( this, ODbTypeWizDialogSetup, OnSingleDocumentChosen ) );
+}
+
+void ODbTypeWizDialogSetup::SetFinalPage(OFinalDBPageSetup* pPage)
+{
+ m_pFinalPage = pPage;
+}
+
std::unique_ptr<BuilderPage> ODbTypeWizDialogSetup::createPage(WizardState _nState)
{
std::unique_ptr<OGenericAdministrationPage> xPage;
@@ -463,11 +477,6 @@ std::unique_ptr<BuilderPage> ODbTypeWizDialogSetup::createPage(WizardState _nSta
{
case PAGE_DBSETUPWIZARD_INTRO:
xPage = std::make_unique<OGeneralPageWizard>(pPageContainer,this,*m_pOutSet);
- m_pGeneralPage = static_cast<OGeneralPageWizard*>(xPage.get());
- m_pGeneralPage->SetTypeSelectHandler(LINK(this, ODbTypeWizDialogSetup, OnTypeSelected));
- m_pGeneralPage->SetCreationModeHandler(LINK( this, ODbTypeWizDialogSetup, OnChangeCreationMode ) );
- m_pGeneralPage->SetDocumentSelectionHandler(LINK( this, ODbTypeWizDialogSetup, OnRecentDocumentSelected ) );
- m_pGeneralPage->SetChooseDocumentHandler(LINK( this, ODbTypeWizDialogSetup, OnSingleDocumentChosen ) );
break;
case PAGE_DBSETUPWIZARD_DBASE:
@@ -533,7 +542,6 @@ std::unique_ptr<BuilderPage> ODbTypeWizDialogSetup::createPage(WizardState _nSta
case PAGE_DBSETUPWIZARD_FINAL:
xPage = OFinalDBPageSetup::CreateFinalDBTabPageSetup(pPageContainer, this, *m_pOutSet);
- m_pFinalPage = static_cast<OFinalDBPageSetup*>(xPage.get());
break;
}
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index 52c1714f776a..cf564821fcf0 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -42,6 +42,7 @@
#include <unotools/confignode.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
+#include <dbwizsetup.hxx>
namespace dbaui
{
@@ -443,7 +444,7 @@ namespace dbaui
}
// OGeneralPageWizard
- OGeneralPageWizard::OGeneralPageWizard(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rItems)
+ OGeneralPageWizard::OGeneralPageWizard(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rItems)
: OGeneralPage( pPage, pController, "dbaccess/ui/generalpagewizard.ui", _rItems )
, m_xRB_CreateDatabase(m_xBuilder->weld_radio_button("createDatabase"))
, m_xRB_OpenExistingDatabase(m_xBuilder->weld_radio_button("openExistingDatabase"))
@@ -488,6 +489,8 @@ namespace dbaui
m_xRB_OpenExistingDatabase->connect_clicked( LINK( this, OGeneralPageWizard, OnSetupModeSelected ) );
m_xLB_DocumentList->connect_changed( LINK( this, OGeneralPageWizard, OnDocumentSelected ) );
m_xPB_OpenDatabase->connect_clicked( LINK( this, OGeneralPageWizard, OnOpenDocument ) );
+
+ pController->SetGeneralPage(this);
}
OGeneralPageWizard::~OGeneralPageWizard()
diff --git a/dbaccess/source/ui/dlg/generalpage.hxx b/dbaccess/source/ui/dlg/generalpage.hxx
index 1579b6bb74a6..e8af35387728 100644
--- a/dbaccess/source/ui/dlg/generalpage.hxx
+++ b/dbaccess/source/ui/dlg/generalpage.hxx
@@ -25,6 +25,8 @@
namespace dbaui
{
+ class ODbTypeWizDialogSetup;
+
// OGeneralPage
class OGeneralPage : public OGenericAdministrationPage
{
@@ -114,7 +116,7 @@ namespace dbaui
class OGeneralPageWizard final : public OGeneralPage
{
public:
- OGeneralPageWizard( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rItems );
+ OGeneralPageWizard( weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& _rItems );
virtual ~OGeneralPageWizard() override;
enum CreationMode
diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx
index c130882139ec..b7205532c2b7 100644
--- a/dbaccess/source/ui/inc/dbwizsetup.hxx
+++ b/dbaccess/source/ui/inc/dbwizsetup.hxx
@@ -123,6 +123,8 @@ public:
bool IsTableWizardToBeStarted() const;
void SetIntroPage(OMySQLIntroPageSetup* pPage);
+ void SetGeneralPage(OGeneralPageWizard* pPage);
+ void SetFinalPage(OFinalDBPageSetup* pPage);
private:
/// to override to create new pages