[Libreoffice-commits] core.git: dbaccess/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Oct 20 17:17:45 UTC 2019


 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(-)

New commits:
commit 4dde0d06bdc00c3783cfe94e8f918a8913274c4e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Oct 20 15:55:23 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Oct 20 19:16:47 2019 +0200

    cid#1453991 Wrapper object use after free
    
    Change-Id: I4ea3ed40deaf20e91e1a0a42ee115cf761853875
    Reviewed-on: https://gerrit.libreoffice.org/81170
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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 <unotools/pathoptions.hxx>
 #include <vcl/roadmapwizard.hxx>
+#include <dbwizsetup.hxx>
 #include "TextConnectionHelper.hxx"
 #include <osl/diagnose.h>
 
@@ -219,12 +220,12 @@ using namespace ::com::sun::star;
         OGenericAdministrationPage::callModifiedHdl();
     }
 
-    std::unique_ptr<OMySQLIntroPageSetup> OMySQLIntroPageSetup::CreateMySQLIntroTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet)
+    std::unique_ptr<OMySQLIntroPageSetup> OMySQLIntroPageSetup::CreateMySQLIntroTabPage(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& rAttrSet)
     {
         return std::make_unique<OMySQLIntroPageSetup>(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 <ucbhelper/content.hxx>
 
 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<OMySQLIntroPageSetup> CreateMySQLIntroTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttrSet);
+        static std::unique_ptr<OMySQLIntroPageSetup> CreateMySQLIntroTabPage(weld::Container* pPage, ODbTypeWizDialogSetup* pController, const SfxItemSet& rAttrSet);
         ConnectionType      getMySQLMode() const;
         void                SetClickHdl( const Link<OMySQLIntroPageSetup *, void>& 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<BuilderPage> ODbTypeWizDialogSetup::createPage(WizardState _nState)
 {
     std::unique_ptr<OGenericAdministrationPage> xPage;
@@ -515,8 +521,6 @@ std::unique_ptr<BuilderPage> ODbTypeWizDialogSetup::createPage(WizardState _nSta
             break;
         case PAGE_DBSETUPWIZARD_MYSQL_INTRO:
             xPage = OMySQLIntroPageSetup::CreateMySQLIntroTabPage(pPageContainer, this, *m_pOutSet);
-            m_pMySQLIntroPage = static_cast<OMySQLIntroPageSetup*>(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<BuilderPage> createPage(WizardState _nState) override;


More information about the Libreoffice-commits mailing list