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

Henry Castro hcastro at collabora.com
Mon Feb 15 22:12:11 UTC 2016


 vcl/source/app/svdata.cxx |    4 ++--
 vcl/source/app/svmain.cxx |   10 +++++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 4886676a5b50caf0946b91491055cbdc2696f1ca
Author: Henry Castro <hcastro at collabora.com>
Date:   Mon Sep 7 17:43:04 2015 -0400

    vcl: assign nullptr after deleting
    
    In the preinit stage, the VCL initialization is done by the parent process
    and when the lo_startmain thread de-initialize the VCL, some services are
    disposed early, and it causes segmentation violation.
    
    So it is ensured that pointers to service objetcs is set nullptr after
    deleting.
    
    Change-Id: I65ecfc2d2694a981ec2986988efabdfd28d0cce4

diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index c3fbdf5..19c663a 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -100,10 +100,10 @@ void ImplDeInitSVData()
 
     // delete global instance data
     if( pSVData->mpSettingsConfigItem )
-        delete pSVData->mpSettingsConfigItem;
+        delete pSVData->mpSettingsConfigItem, pSVData->mpSettingsConfigItem = nullptr;
 
     if( pSVData->mpDockingManager )
-        delete pSVData->mpDockingManager;
+        delete pSVData->mpDockingManager, pSVData->mpDockingManager = nullptr;
 
     if( pSVData->maCtrlData.mpFieldUnitStrings )
         delete pSVData->maCtrlData.mpFieldUnitStrings, pSVData->maCtrlData.mpFieldUnitStrings = nullptr;
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index f59f5f9..a8bac57 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -386,7 +386,7 @@ void DeInitVCL()
         delete pSVData->mpSettingsConfigItem, pSVData->mpSettingsConfigItem = nullptr;
 
     if ( pSVData->maAppData.mpIdleMgr )
-        delete pSVData->maAppData.mpIdleMgr;
+        delete pSVData->maAppData.mpIdleMgr, pSVData->maAppData.mpIdleMgr = nullptr;
     Scheduler::ImplDeInitScheduler();
 
     if ( pSVData->maWinData.mpMsgBoxImgList )
@@ -551,7 +551,11 @@ void DeInitVCL()
     pSVData->mpSalTimer = nullptr;
 
     // Deinit Sal
-    DestroySalInstance( pSVData->mpDefInst );
+    if (pSVData->mpDefInst)
+    {
+        DestroySalInstance( pSVData->mpDefInst );
+        pSVData->mpDefInst = nullptr;
+    }
 
     if( pOwnSvApp )
     {
@@ -578,7 +582,7 @@ struct WorkerThreadData
 static HANDLE hThreadID = 0;
 static unsigned __stdcall _threadmain( void *pArgs )
 {
-    OleInitialize( NULL );
+    OleInitialize( nullptr );
     ((WorkerThreadData*)pArgs)->pWorker( ((WorkerThreadData*)pArgs)->pThreadData );
     delete (WorkerThreadData*)pArgs;
     OleUninitialize();


More information about the Libreoffice-commits mailing list