summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-12-02 12:47:48 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-12-02 12:48:14 +0000
commit1a8f7865450047e6e5b01598c5658026f392388e (patch)
treecc02ac1f3bee7abab531fadd1ee040586cf41d55 /desktop
parent1eafd90aee0c945b941db99d70a25d1b633c1401 (diff)
ensure lockfile doesn't leak
Change-Id: I6a4c7024da154104d985bca25b26a8243174ec8d
Diffstat (limited to 'desktop')
-rw-r--r--desktop/inc/app.hxx3
-rw-r--r--desktop/source/app/app.cxx24
2 files changed, 7 insertions, 20 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index dfa74c4dfe0c..8fd1b58103f5 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -22,6 +22,7 @@
// stl includes first
#include <map>
+#include <boost/scoped_ptr.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <vcl/svapp.hxx>
#include <vcl/timer.hxx>
@@ -193,7 +194,7 @@ class Desktop : public Application
OUString m_aBootstrapErrorMessage;
BootstrapStatus m_aBootstrapStatus;
- Lockfile *m_pLockfile;
+ boost::scoped_ptr<Lockfile> m_xLockfile;
Timer m_firstRunTimer;
static ResMgr* pResMgr;
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index f83d8c24b4f7..0f069299667e 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -559,7 +559,6 @@ Desktop::Desktop()
: m_bCleanedExtensionCache( false )
, m_bServicesRegistered( false )
, m_aBootstrapError( BE_OK )
-, m_pLockfile( NULL )
{
RTL_LOGFILE_TRACE( "desktop (cd100003) ::Desktop::Desktop" );
}
@@ -656,11 +655,7 @@ void Desktop::DeInit()
::comphelper::setProcessServiceFactory( NULL );
// clear lockfile
- if (m_pLockfile != NULL)
- {
- delete m_pLockfile;
- m_pLockfile = NULL;
- }
+ m_xLockfile.reset();
OfficeIPCThread::DisableOfficeIPCThread();
if( pSignalHandler )
@@ -721,11 +716,7 @@ sal_Bool Desktop::QueryExit()
{
}
- if (m_pLockfile != NULL)
- {
- delete m_pLockfile;
- m_pLockfile = NULL;
- }
+ m_xLockfile.reset();
}
@@ -1292,11 +1283,7 @@ sal_uInt16 Desktop::Exception(sal_uInt16 nError)
default:
{
- if (m_pLockfile != NULL)
- {
- delete m_pLockfile;
- m_pLockfile = NULL;
- }
+ m_xLockfile.reset();
if( bRestart )
{
@@ -1452,11 +1439,10 @@ int Desktop::Main()
// check user installation directory for lockfile so we can be sure
// there is no other instance using our data files from a remote host
RTL_LOGFILE_CONTEXT_TRACE( aLog, "desktop (lo119109) Desktop::Main -> Lockfile" );
- delete m_pLockfile;
- m_pLockfile = new Lockfile;
+ m_xLockfile.reset(new Lockfile);
#ifndef ANDROID
if ( !rCmdLineArgs.IsHeadless() && !rCmdLineArgs.IsInvisible() &&
- !rCmdLineArgs.IsNoLockcheck() && !m_pLockfile->check( Lockfile_execWarning ))
+ !rCmdLineArgs.IsNoLockcheck() && !m_xLockfile->check( Lockfile_execWarning ))
{
// Lockfile exists, and user clicked 'no'
return EXIT_FAILURE;