[Libreoffice-commits] core.git: 2 commits - sfx2/source sw/qa
Mike Kaganski
mike.kaganski at collabora.com
Fri Jan 19 19:22:12 UTC 2018
sfx2/source/appl/impldde.cxx | 23 ++++++++++-------------
sfx2/source/appl/impldde.hxx | 6 +++---
sw/qa/extras/uiwriter/uiwriter.cxx | 7 ++++++-
3 files changed, 19 insertions(+), 17 deletions(-)
New commits:
commit 8da0832fe5f216768e3c4f17334ed15ef7b4de85
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date: Fri Jan 19 10:14:07 2018 +0100
Don't create database files in $HOME
Regression from commit 46b3202bf883618f1585850191c19776861013ed
Change-Id: If8e0b309274ea14e996e0dde2d1ee9b49ff0f737
Reviewed-on: https://gerrit.libreoffice.org/48173
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index f32c512d84de..6f4903f98d2f 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -5765,13 +5765,16 @@ void SwUiWriterTest::testTdf115013()
{
const OUString sColumnName("Name with spaces, \"quotes\" and \\backslashes");
+ utl::TempFile aTempDir(nullptr, true);
+ const OUString aWorkDir = aTempDir.GetURL();
+
//create new writer document
SwDoc* pDoc = createDoc();
{
// Load and register data source
const OUString aDataSourceURI(m_directories.getURLFromSrc(DATA_DIRECTORY) + "datasource.ods");
- OUString sDataSource = SwDBManager::LoadAndRegisterDataSource(aDataSourceURI, nullptr);
+ OUString sDataSource = SwDBManager::LoadAndRegisterDataSource(aDataSourceURI, &aWorkDir);
CPPUNIT_ASSERT(!sDataSource.isEmpty());
// Insert a new field type for the mailmerge field
@@ -5805,6 +5808,8 @@ void SwUiWriterTest::testTdf115013()
OUString sColumn = static_cast<SwDBFieldType*>(pField->GetTyp())->GetColumnName();
// The column name must come correct after round trip
CPPUNIT_ASSERT_EQUAL(sColumnName, sColumn);
+
+ utl::removeTree(aWorkDir);
}
void SwUiWriterTest::testTdf115065()
commit 57a70245f5ad4b8bb722c1dc0aaa06f3d42965f4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Jan 16 15:20:17 2018 +0200
loplugin:useuniqueptr in SvDDEObject
Change-Id: Ia7f98a84bd42289ef0673b52e5e74a6a24554402
Reviewed-on: https://gerrit.libreoffice.org/48168
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx
index 2ed6388bbe97..4428f875bd08 100644
--- a/sfx2/source/appl/impldde.cxx
+++ b/sfx2/source/appl/impldde.cxx
@@ -126,9 +126,9 @@ SvDDEObject::SvDDEObject()
SvDDEObject::~SvDDEObject()
{
- delete pLink;
- delete pRequest;
- delete pConnection;
+ pLink.reset();
+ pRequest.reset();
+ pConnection.reset();
}
bool SvDDEObject::GetData( css::uno::Any & rData /*out param*/,
@@ -143,8 +143,7 @@ bool SvDDEObject::GetData( css::uno::Any & rData /*out param*/,
OUString sServer( pConnection->GetServiceName() );
OUString sTopic( pConnection->GetTopicName() );
- delete pConnection;
- pConnection = new DdeConnection( sServer, sTopic );
+ pConnection.reset( new DdeConnection( sServer, sTopic ) );
}
if( bWaitForData ) // we are in an rekursive loop, get out again
@@ -172,9 +171,7 @@ bool SvDDEObject::GetData( css::uno::Any & rData /*out param*/,
{
// otherwise it will be executed asynchronously
{
- delete pRequest;
-
- pRequest = new DdeRequest( *pConnection, sItem );
+ pRequest.reset( new DdeRequest( *pConnection, sItem ) );
pRequest->SetDataHdl( LINK( this, SvDDEObject, ImplGetDDEData ) );
pRequest->SetDoneHdl( LINK( this, SvDDEObject, ImplDoneDDEData ) );
pRequest->SetFormat( SotExchange::GetFormatIdFromMimeType(
@@ -213,7 +210,7 @@ bool SvDDEObject::Connect( SvBaseLink * pSvLink )
if( sServer.isEmpty() || sTopic.isEmpty() || sItem.isEmpty() )
return false;
- pConnection = new DdeConnection( sServer, sTopic );
+ pConnection.reset( new DdeConnection( sServer, sTopic ) );
if( pConnection->GetError() )
{
// check if the DDE server knows the "SYSTEM" topic
@@ -234,7 +231,7 @@ bool SvDDEObject::Connect( SvBaseLink * pSvLink )
if( SfxLinkUpdateMode::ALWAYS == nLinkType && !pLink && !pConnection->GetError() )
{
// Setting up Hot Link, Data will be available at some point later on
- pLink = new DdeHotLink( *pConnection, sItem );
+ pLink.reset( new DdeHotLink( *pConnection, sItem ) );
pLink->SetDataHdl( LINK( this, SvDDEObject, ImplGetDDEData ) );
pLink->SetDoneHdl( LINK( this, SvDDEObject, ImplDoneDDEData ) );
pLink->SetFormat( pSvLink->GetContentType() );
@@ -347,9 +344,9 @@ IMPL_LINK( SvDDEObject, ImplDoneDDEData, bool, bValid, void )
{
DdeTransaction* pReq = nullptr;
if( !pLink || ( pLink && pLink->IsBusy() ))
- pReq = pRequest; // only the one that is ready
+ pReq = pRequest.get(); // only the one that is ready
else if( pRequest && pRequest->IsBusy() )
- pReq = pLink; // only the one that is ready
+ pReq = pLink.get(); // only the one that is ready
if( pReq )
{
@@ -357,7 +354,7 @@ IMPL_LINK( SvDDEObject, ImplDoneDDEData, bool, bValid, void )
{
pReq->Execute();
}
- else if( pReq == pRequest )
+ else if( pReq == pRequest.get() )
{
bWaitForData = false;
}
diff --git a/sfx2/source/appl/impldde.hxx b/sfx2/source/appl/impldde.hxx
index 5c2bc3a014c4..d161a783fa61 100644
--- a/sfx2/source/appl/impldde.hxx
+++ b/sfx2/source/appl/impldde.hxx
@@ -35,9 +35,9 @@ class SvDDEObject : public SvLinkSource
{
OUString sItem;
- DdeConnection* pConnection;
- DdeLink* pLink;
- DdeRequest* pRequest;
+ std::unique_ptr<DdeConnection> pConnection;
+ std::unique_ptr<DdeLink> pLink;
+ std::unique_ptr<DdeRequest> pRequest;
css::uno::Any * pGetData;
bool bWaitForData; // waiting for data?
More information about the Libreoffice-commits
mailing list