[Libreoffice-commits] core.git: 3 commits - basic/inc basic/qa basic/source include/basic sfx2/source

Michael Stahl mstahl at redhat.com
Thu Oct 23 12:36:21 PDT 2014


 basic/inc/sbxbase.hxx            |   10 +++-------
 basic/qa/cppunit/basictest.hxx   |    2 +-
 basic/source/runtime/basrdll.cxx |   36 +++++++++++++++++++++++++++++-------
 basic/source/sbx/sbxbase.cxx     |   15 ++++++++-------
 include/basic/basrdll.hxx        |   15 +++++++--------
 sfx2/source/appl/app.cxx         |    5 +++--
 6 files changed, 51 insertions(+), 32 deletions(-)

New commits:
commit 28adfcdcbc504db8d5014a8939aa5e834e5d43d0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Oct 23 21:07:49 2014 +0200

    fdo#84935: basic: avoid silly SolarMutex asserts on exit on Mac
    
    Change-Id: If22b8ff962d2b68130176de3b7b9eccacfc850dc

diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index c9ec487..0a88f54 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -19,6 +19,7 @@
 
 #include <tools/debug.hxx>
 #include <tools/stream.hxx>
+#include <vcl/svapp.hxx>
 
 #include <basic/sbx.hxx>
 #include <basic/sbxfac.hxx>
@@ -41,7 +42,10 @@ SbxAppData::SbxAppData()
 
 SbxAppData::~SbxAppData()
 {
+    SolarMutexGuard g;
+
     delete pBasicFormater;
+    aFacs.clear();
 }
 
 SbxBase::SbxBase()
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index 0eeb327..7c3b888 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -232,11 +232,12 @@ SfxApplication::~SfxApplication()
     // delete global options
     SvtViewOptions::ReleaseOptions();
 
+    if ( !pAppData_Impl->bDowning )
+        Deinitialize();
+
 #if HAVE_FEATURE_SCRIPTING
     delete pBasic;
 #endif
-    if ( !pAppData_Impl->bDowning )
-        Deinitialize();
 
     delete pAppData_Impl;
     pApp = 0;
commit 51906611abb53e8a22f2d460964e87b0b399d684
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Oct 23 21:05:31 2014 +0200

    basic: move SbxAppData to a BasicDLL member
    
    ... so it is deleted by ~SfxApplication.
    
    Change-Id: I161bd92eb9b5082d1fdeea603921d0372a4d97e6

diff --git a/basic/inc/sbxbase.hxx b/basic/inc/sbxbase.hxx
index de1152c..21bb7d4 100644
--- a/basic/inc/sbxbase.hxx
+++ b/basic/inc/sbxbase.hxx
@@ -24,6 +24,7 @@
 #include <basic/sbxdef.hxx>
 #include <basic/basicdllapi.h>
 #include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/noncopyable.hpp>
 
 class SbxFactory;
 class SbxVariable;
@@ -33,6 +34,7 @@ typedef boost::ptr_vector<SbxFactory> SbxFacs;
 
 // AppData structure for SBX:
 struct SbxAppData
+    : private ::boost::noncopyable
 {
     SbxError            eSbxError;  // Error code
     SbxFacs             aFacs;      // Factories
@@ -41,13 +43,7 @@ struct SbxAppData
     LanguageType        eBasicFormaterLangType;
     // It might be useful to store this class 'global' because some string reosurces are saved here
 
-    SbxAppData()
-        : eSbxError(SbxERR_OK)
-        , aFacs()
-        , pBasicFormater(NULL)
-        , eBasicFormaterLangType(LANGUAGE_DONTKNOW)
-    {
-    }
+    SbxAppData();
     ~SbxAppData();
 };
 
diff --git a/basic/qa/cppunit/basictest.hxx b/basic/qa/cppunit/basictest.hxx
index af0c0e8..6b1d516 100644
--- a/basic/qa/cppunit/basictest.hxx
+++ b/basic/qa/cppunit/basictest.hxx
@@ -25,9 +25,9 @@ class MacroSnippet
 {
     private:
     bool mbError;
+    BasicDLL maDll; // we need a dll instance for resouce manager etc.
     SbModuleRef mpMod;
     StarBASICRef mpBasic;
-    BasicDLL maDll; // we need a dll instance for resouce manager etc.
 
     void InitSnippet()
     {
diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index 9086a05..167433c 100644
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -28,6 +28,7 @@
 #include <basic/basrdll.hxx>
 #include <basrid.hxx>
 #include <sb.hrc>
+#include <sbxbase.hxx>
 
 struct BasicDLL::Impl
 {
@@ -35,11 +36,13 @@ struct BasicDLL::Impl
     bool        bBreakEnabled;
 
     ::boost::scoped_ptr<ResMgr> pBasResMgr;
+    ::boost::scoped_ptr<SbxAppData> pSbxAppData;
 
     Impl()
         : bDebugMode(false)
         , bBreakEnabled(true)
         , pBasResMgr(ResMgr::CreateResMgr("sb", Application::GetSettings().GetUILanguageTag()))
+        , pSbxAppData(new SbxAppData)
     { }
 };
 
@@ -102,4 +105,9 @@ void BasicDLL::BasicBreak()
     }
 }
 
+SbxAppData& GetSbxData_Impl()
+{
+    return *BASIC_DLL()->m_pImpl->pSbxAppData;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 89cb735..c9ec487 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -32,14 +32,11 @@
 
 TYPEINIT0(SbxBase)
 
-namespace
+SbxAppData::SbxAppData()
+    : eSbxError(SbxERR_OK)
+    , pBasicFormater(0)
+    , eBasicFormaterLangType(LANGUAGE_DONTKNOW)
 {
-    class theSbxAppData : public rtl::Static<SbxAppData, theSbxAppData> {};
-}
-
-SbxAppData& GetSbxData_Impl()
-{
-    return theSbxAppData::get();
 }
 
 SbxAppData::~SbxAppData()
commit a7498603d8b532a1560c3ab816ddb941ad472945
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Oct 23 20:40:49 2014 +0200

    basic: pimplify that
    
    Change-Id: I0abe66ded0fd69a2720ad64e1a1426aafc7dfffb

diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx
index 6438b5b..9086a05 100644
--- a/basic/source/runtime/basrdll.cxx
+++ b/basic/source/runtime/basrdll.cxx
@@ -29,31 +29,44 @@
 #include <basrid.hxx>
 #include <sb.hrc>
 
+struct BasicDLL::Impl
+{
+    bool        bDebugMode;
+    bool        bBreakEnabled;
+
+    ::boost::scoped_ptr<ResMgr> pBasResMgr;
+
+    Impl()
+        : bDebugMode(false)
+        , bBreakEnabled(true)
+        , pBasResMgr(ResMgr::CreateResMgr("sb", Application::GetSettings().GetUILanguageTag()))
+    { }
+};
+
 BasResId::BasResId( sal_uInt32 nId ) :
     ResId( nId, *(BASIC_DLL()->GetBasResMgr()) )
 {
 }
 
 BasicDLL::BasicDLL()
+    : m_pImpl(new Impl)
 {
     BASIC_DLL() = this;
-    pBasResMgr = ResMgr::CreateResMgr("sb", Application::GetSettings().GetUILanguageTag() );
-    bDebugMode = false;
-    bBreakEnabled = true;
 }
 
 BasicDLL::~BasicDLL()
 {
-    delete pBasResMgr;
 }
 
+ResMgr* BasicDLL::GetBasResMgr() const { return m_pImpl->pBasResMgr.get(); }
+
 void BasicDLL::EnableBreak( bool bEnable )
 {
     BasicDLL* pThis = BASIC_DLL();
     DBG_ASSERT( pThis, "BasicDLL::EnableBreak: No instance yet!" );
     if ( pThis )
     {
-        pThis->bBreakEnabled = bEnable;
+        pThis->m_pImpl->bBreakEnabled = bEnable;
     }
 }
 
@@ -63,7 +76,7 @@ void BasicDLL::SetDebugMode( bool bDebugMode )
     DBG_ASSERT( pThis, "BasicDLL::EnableBreak: No instance yet!" );
     if ( pThis )
     {
-        pThis->bDebugMode = bDebugMode;
+        pThis->m_pImpl->bDebugMode = bDebugMode;
     }
 }
 
@@ -78,7 +91,8 @@ void BasicDLL::BasicBreak()
     DBG_ASSERT( pThis, "BasicDLL::EnableBreak: No instance yet!" );
     if ( pThis )
     {
-        if ( StarBASIC::IsRunning() && !bJustStopping && ( pThis->bBreakEnabled || pThis->bDebugMode ) )
+        if (StarBASIC::IsRunning() && !bJustStopping
+            && (pThis->m_pImpl->bBreakEnabled || pThis->m_pImpl->bDebugMode))
         {
             bJustStopping = true;
             StarBASIC::Stop();
diff --git a/include/basic/basrdll.hxx b/include/basic/basrdll.hxx
index bf6ba73..274126d 100644
--- a/include/basic/basrdll.hxx
+++ b/include/basic/basrdll.hxx
@@ -20,24 +20,23 @@
 #ifndef INCLUDED_BASIC_BASRDLL_HXX
 #define INCLUDED_BASIC_BASRDLL_HXX
 
-class ResMgr;
+#include <boost/scoped_ptr.hpp>
 
-#include <vcl/accel.hxx>
 #include <basic/basicdllapi.h>
 
+class ResMgr;
+
 class BASIC_DLLPUBLIC BasicDLL
 {
-private:
-    ResMgr*     pBasResMgr;
-
-    bool        bDebugMode;
-    bool        bBreakEnabled;
+public:
+    struct Impl;
+    ::boost::scoped_ptr<Impl> m_pImpl;
 
 public:
                 BasicDLL();
                 ~BasicDLL();
 
-    ResMgr*     GetBasResMgr() const { return pBasResMgr; }
+    ResMgr*     GetBasResMgr() const;
 
     static void BasicBreak();
 


More information about the Libreoffice-commits mailing list