[Libreoffice-commits] .: desktop/inc desktop/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Dec 2 04:48:48 PST 2012


 desktop/inc/app.hxx        |    3 ++-
 desktop/source/app/app.cxx |   24 +++++-------------------
 2 files changed, 7 insertions(+), 20 deletions(-)

New commits:
commit 1a8f7865450047e6e5b01598c5658026f392388e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Dec 2 12:47:48 2012 +0000

    ensure lockfile doesn't leak
    
    Change-Id: I6a4c7024da154104d985bca25b26a8243174ec8d

diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index dfa74c4..8fd1b58 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 f83d8c2..0f06929 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;


More information about the Libreoffice-commits mailing list