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

Stephan Bergmann sbergman at redhat.com
Wed Dec 10 09:25:01 PST 2014


 include/vcl/svapp.hxx            |    1 -
 vcl/inc/svdata.hxx               |    7 +++----
 vcl/source/app/svapp.cxx         |    3 ---
 vcl/source/app/svdata.cxx        |   20 +++++++-------------
 vcl/source/app/svmain.cxx        |    3 ---
 vcl/source/helper/lazydelete.cxx |    5 -----
 6 files changed, 10 insertions(+), 29 deletions(-)

New commits:
commit 55b68ad017d61f2fd4a3408632007880aabd05fe
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Dec 10 18:24:23 2014 +0100

    Instantiate ImplSVData on demand
    
    Change-Id: I661949a8635a2ed1a1efda77ced48a0fa9f6722e

diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index b4d69ba..fbc42ab 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -241,7 +241,6 @@ public:
     @attention The initialization of the application itself is done in Init()
 
     @see    InitSalData is implemented by platform specific code.
-            ImplInitSVData initializes the global instance data
     */
                                 Application();
 
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 5fb496b..683f40d 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -300,6 +300,8 @@ struct BlendFrameCache
 
 struct ImplSVData
 {
+    ImplSVData();
+
     SalData*                mpSalData;
     SalInstance*            mpDefInst;                      // Default SalInstance
     Application*            mpApp;                          // pApp
@@ -339,9 +341,7 @@ struct ImplSVData
     Link maDeInitHook;
 };
 
-void        ImplInitSVData();
 void        ImplDeInitSVData();
-void        ImplDestroySVData();
 VCL_PLUGIN_PUBLIC vcl::Window* ImplGetDefaultWindow();
 VCL_PLUGIN_PUBLIC ResMgr*     ImplGetResMgr();
 VCL_PLUGIN_PUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr
@@ -357,8 +357,7 @@ void        ImplFreeEventHookData();
 
 bool        ImplCallPreNotify( NotifyEvent& rEvt );
 
-extern VCL_PLUGIN_PUBLIC ImplSVData* pImplSVData;
-inline ImplSVData* ImplGetSVData() { return pImplSVData; }
+VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData();
 VCL_PLUGIN_PUBLIC void ImplHideSplash();
 
 bool ImplInitAccessBridge();
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 98b7454..f7a696f 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -194,8 +194,6 @@ Application::Application()
     OUString aVar("LIBO_VERSION"), aValue(LIBO_VERSION_DOTTED);
     osl_setEnvironment(aVar.pData, aValue.pData);
 
-    if( ! ImplGetSVData() )
-        ImplInitSVData();
     ImplGetSVData()->mpApp = this;
     InitSalData();
 }
@@ -205,7 +203,6 @@ Application::~Application()
     ImplDeInitSVData();
     DeInitSalData();
     ImplGetSVData()->mpApp = NULL;
-    ImplDestroySVData();
 }
 
 int Application::Main()
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 59b2d23..c539a76 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -64,8 +64,9 @@ namespace
         public rtl::Static<ImplSVData, private_aImplSVData> {};
 }
 
-// static SV-Data
-ImplSVData* pImplSVData = NULL;
+ImplSVData* ImplGetSVData() {
+    return &private_aImplSVData::get();
+}
 
 SalSystem* ImplGetSalSystem()
 {
@@ -75,14 +76,12 @@ SalSystem* ImplGetSalSystem()
     return pSVData->mpSalSystem;
 }
 
-void ImplInitSVData()
+ImplSVData::ImplSVData()
 {
-    pImplSVData = &private_aImplSVData::get();
-
     // init global instance data
-    memset( pImplSVData, 0, sizeof( ImplSVData ) );
-    pImplSVData->maHelpData.mbAutoHelpId = true;
-    pImplSVData->maNWFData.maMenuBarHighlightTextColor = Color( COL_TRANSPARENT );
+    memset( this, 0, sizeof( ImplSVData ) );
+    maHelpData.mbAutoHelpId = true;
+    maNWFData.maMenuBarHighlightTextColor = Color( COL_TRANSPARENT );
 }
 
 void ImplDeInitSVData()
@@ -104,11 +103,6 @@ void ImplDeInitSVData()
         delete pSVData->mpPaperNames, pSVData->mpPaperNames = NULL;
 }
 
-void ImplDestroySVData()
-{
-    pImplSVData = NULL;
-}
-
 vcl::Window* ImplGetDefaultWindow()
 {
     ImplSVData* pSVData = ImplGetSVData();
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index c1456ad..7636738 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -240,9 +240,6 @@ bool InitVCL()
 
     EmbeddedFontsHelper::clearTemporaryFontFiles();
 
-    if( ! ImplGetSVData() )
-        ImplInitSVData();
-
     if( !ImplGetSVData()->mpApp )
     {
         pOwnSvApp = new Application();
diff --git a/vcl/source/helper/lazydelete.cxx b/vcl/source/helper/lazydelete.cxx
index 7ce8d1a..45ea7e0 100644
--- a/vcl/source/helper/lazydelete.cxx
+++ b/vcl/source/helper/lazydelete.cxx
@@ -80,11 +80,6 @@ DeleteOnDeinitBase::~DeleteOnDeinitBase()
 void DeleteOnDeinitBase::addDeinitContainer( DeleteOnDeinitBase* i_pContainer )
 {
     ImplSVData* pSVData = ImplGetSVData();
-    if( ! pSVData )
-    {
-        ImplInitSVData();
-        pSVData = ImplGetSVData();
-    }
 
     DBG_ASSERT( ! pSVData->mbDeInit, "DeleteOnDeinit added after DeiInitVCL !" );
     if( pSVData->mbDeInit )


More information about the Libreoffice-commits mailing list