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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 27 16:32:01 UTC 2020


 dbaccess/source/ui/dlg/RelationDlg.cxx                  |    2 +-
 dbaccess/source/ui/inc/RTableConnectionData.hxx         |    2 +-
 dbaccess/source/ui/inc/TableConnectionData.hxx          |    2 +-
 dbaccess/source/ui/querydesign/QTableConnectionData.cxx |    4 ++--
 dbaccess/source/ui/querydesign/QTableConnectionData.hxx |    2 +-
 dbaccess/source/ui/querydesign/QueryTableView.cxx       |    5 ++---
 dbaccess/source/ui/querydesign/TableConnectionData.cxx  |    4 ++--
 dbaccess/source/ui/querydesign/querydlg.cxx             |    2 +-
 8 files changed, 11 insertions(+), 12 deletions(-)

New commits:
commit 030d5c2ad2544c00d779d7e608178c3a3c970cd5
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Apr 27 11:02:17 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Apr 27 18:31:21 2020 +0200

    loplugin:makeshared in dbaccess
    
    Change-Id: Idf5f6179771edaf7af85d95e10b092ce0e3344f2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92969
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/dbaccess/source/ui/dlg/RelationDlg.cxx b/dbaccess/source/ui/dlg/RelationDlg.cxx
index f47d3ccd1d68..cc449d9b7970 100644
--- a/dbaccess/source/ui/dlg/RelationDlg.cxx
+++ b/dbaccess/source/ui/dlg/RelationDlg.cxx
@@ -57,7 +57,7 @@ ORelationDialog::ORelationDialog( OJoinTableView* pParent,
     , m_xPB_OK(m_xBuilder->weld_button("ok"))
 {
     // Copy connection
-    m_pConnData.reset( pConnectionData->NewInstance() );
+    m_pConnData = pConnectionData->NewInstance();
     m_pConnData->CopyFrom( *pConnectionData );
 
     Init(m_pConnData);
diff --git a/dbaccess/source/ui/inc/RTableConnectionData.hxx b/dbaccess/source/ui/inc/RTableConnectionData.hxx
index 88011b23c9aa..bfff5fc9a25e 100644
--- a/dbaccess/source/ui/inc/RTableConnectionData.hxx
+++ b/dbaccess/source/ui/inc/RTableConnectionData.hxx
@@ -55,7 +55,7 @@ namespace dbaui
         virtual ~ORelationTableConnectionData() override;
 
         virtual void CopyFrom(const OTableConnectionData& rSource) override;
-        virtual OTableConnectionData* NewInstance() const override { return new ORelationTableConnectionData(); }
+        virtual std::shared_ptr<OTableConnectionData> NewInstance() const override { return std::make_shared<ORelationTableConnectionData>(); }
 
         /** Update create a new relation
 
diff --git a/dbaccess/source/ui/inc/TableConnectionData.hxx b/dbaccess/source/ui/inc/TableConnectionData.hxx
index 1ad4fcea9056..c55bce40d463 100644
--- a/dbaccess/source/ui/inc/TableConnectionData.hxx
+++ b/dbaccess/source/ui/inc/TableConnectionData.hxx
@@ -62,7 +62,7 @@ namespace dbaui
 
             @note does NOT have to be initialised
          */
-        virtual OTableConnectionData* NewInstance() const;
+        virtual std::shared_ptr<OTableConnectionData> NewInstance() const;
 
         void SetConnLine( sal_uInt16 nIndex, const OUString& rSourceFieldName, const OUString& rDestFieldName );
         bool AppendConnLine( const OUString& rSourceFieldName, const OUString& rDestFieldName );
diff --git a/dbaccess/source/ui/querydesign/QTableConnectionData.cxx b/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
index c18b5496bd08..f96a5b1cd033 100644
--- a/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
+++ b/dbaccess/source/ui/querydesign/QTableConnectionData.cxx
@@ -100,9 +100,9 @@ void OQueryTableConnectionData::InitFromDrag(const OTableFieldDescRef& rDragLeft
     AppendConnLine(rDragLeft->GetField(), rDragRight->GetField());
 }
 
-OTableConnectionData* OQueryTableConnectionData::NewInstance() const
+std::shared_ptr<OTableConnectionData> OQueryTableConnectionData::NewInstance() const
 {
-    return new OQueryTableConnectionData();
+    return std::make_shared<OQueryTableConnectionData>();
 }
 
 bool OQueryTableConnectionData::Update()
diff --git a/dbaccess/source/ui/querydesign/QTableConnectionData.hxx b/dbaccess/source/ui/querydesign/QTableConnectionData.hxx
index 179791142f66..41639470f1c1 100644
--- a/dbaccess/source/ui/querydesign/QTableConnectionData.hxx
+++ b/dbaccess/source/ui/querydesign/QTableConnectionData.hxx
@@ -40,7 +40,7 @@ namespace dbaui
         virtual ~OQueryTableConnectionData() override;
 
         virtual void CopyFrom(const OTableConnectionData& rSource) override;
-        virtual OTableConnectionData* NewInstance() const override;
+        virtual std::shared_ptr<OTableConnectionData> NewInstance() const override;
 
 
         /** Update create a new connection
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 728925e4f600..1847cfe7b5ee 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -303,10 +303,9 @@ void OQueryTableView::NotifyTabConnection(const OQueryTableConnection& rNewConn,
     if (pTabConn == nullptr)
     {
         // the new data ...
-        OQueryTableConnectionData* pNewData = static_cast< OQueryTableConnectionData*>(rNewConn.GetData()->NewInstance());
+        auto pNewData = std::static_pointer_cast<OQueryTableConnectionData>(rNewConn.GetData()->NewInstance());
         pNewData->CopyFrom(*rNewConn.GetData());
-        TTableConnectionData::value_type aData(pNewData);
-        VclPtrInstance<OQueryTableConnection> pNewConn(this, aData);
+        VclPtrInstance<OQueryTableConnection> pNewConn(this, pNewData);
         GetConnection(pNewConn);
 
         connectionModified(this,pNewConn,_bCreateUndoAction);
diff --git a/dbaccess/source/ui/querydesign/TableConnectionData.cxx b/dbaccess/source/ui/querydesign/TableConnectionData.cxx
index f8498f058e52..107d8a9d1a48 100644
--- a/dbaccess/source/ui/querydesign/TableConnectionData.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnectionData.cxx
@@ -119,9 +119,9 @@ void OTableConnectionData::ResetConnLines()
     OConnectionLineDataVec().swap(m_vConnLineData);
 }
 
-OTableConnectionData* OTableConnectionData::NewInstance() const
+std::shared_ptr<OTableConnectionData> OTableConnectionData::NewInstance() const
 {
-    return new OTableConnectionData();
+    return std::make_shared<OTableConnectionData>();
 }
 
 OConnectionLineDataVec::size_type OTableConnectionData::normalizeLines()
diff --git a/dbaccess/source/ui/querydesign/querydlg.cxx b/dbaccess/source/ui/querydesign/querydlg.cxx
index 322368666cc1..422eeb9354fc 100644
--- a/dbaccess/source/ui/querydesign/querydlg.cxx
+++ b/dbaccess/source/ui/querydesign/querydlg.cxx
@@ -61,7 +61,7 @@ DlgQryJoin::DlgQryJoin(const OQueryTableView* pParent,
     m_xML_HelpText->set_size_request(aSize.Width(), aSize.Height());
 
     // Copy connection
-    m_pConnData.reset(_pData->NewInstance());
+    m_pConnData = _pData->NewInstance();
     m_pConnData->CopyFrom(*_pData);
 
     m_xTableControl.reset(new OTableListBoxControl(m_xBuilder.get(), _pTableMap, this));


More information about the Libreoffice-commits mailing list