Kaydet (Commit) 820e64f9 authored tarafından Michael Stahl's avatar Michael Stahl

connectivity: firebird: fix temp directory leak

Dispose the dbaccess document, and recursively delete the temp directory
in Connection::dispose().

Change-Id: Id283289e44b8ca09b88da19920da7f27b551aa7e
üst a2e4d432
......@@ -55,6 +55,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
#include <unotools/tempfile.hxx>
#include <unotools/localfilehelper.hxx>
#include <unotools/ucbstreamhelper.hxx>
using namespace connectivity::firebird;
......@@ -166,7 +167,6 @@ void Connection::construct(const ::rtl::OUString& url, const Sequence< PropertyV
bIsNewDatabase = !m_xEmbeddedStorage->hasElements();
m_pExtractedFDBFile.reset(new ::utl::TempFile(NULL, true));
m_pExtractedFDBFile->EnableKillingFile();
m_sFirebirdURL = m_pExtractedFDBFile->GetFileName() + "/firebird.fdb";
SAL_INFO("connectivity.firebird", "Temporary .fdb location: " << m_sFirebirdURL);
......@@ -785,6 +785,12 @@ void Connection::disposing()
dispose_ChildImpl();
cppu::WeakComponentImplHelperBase::disposing();
m_xDriver.clear();
if (m_pExtractedFDBFile)
{
::utl::removeTree(m_pExtractedFDBFile->GetURL());
m_pExtractedFDBFile.reset();
}
}
void Connection::disposeStatements()
......
......@@ -54,6 +54,8 @@ void FirebirdTest::testEmptyDBConnection()
getDocumentForFileName("firebird_empty.odb");
getConnectionForDocument(xDocument);
closeDocument(uno::Reference<lang::XComponent>(xDocument, uno::UNO_QUERY));
}
/**
......@@ -93,6 +95,8 @@ void FirebirdTest::testIntegerDatabase()
xRow->getString(xColumnLocate->findColumn("_VARCHAR")));
CPPUNIT_ASSERT(!xResultSet->next()); // Should only be one row
closeDocument(uno::Reference<lang::XComponent>(xDocument, uno::UNO_QUERY));
}
CPPUNIT_TEST_SUITE_REGISTRATION(FirebirdTest);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment