summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-10-23 21:05:31 +0200
committerMichael Stahl <mstahl@redhat.com>2014-10-23 21:30:45 +0200
commit51906611abb53e8a22f2d460964e87b0b399d684 (patch)
treefc35b485a564622b53e58858fd10c4aab33f42a0 /basic
parenta7498603d8b532a1560c3ab816ddb941ad472945 (diff)
basic: move SbxAppData to a BasicDLL member
... so it is deleted by ~SfxApplication. Change-Id: I161bd92eb9b5082d1fdeea603921d0372a4d97e6
Diffstat (limited to 'basic')
-rw-r--r--basic/inc/sbxbase.hxx10
-rw-r--r--basic/qa/cppunit/basictest.hxx2
-rw-r--r--basic/source/runtime/basrdll.cxx8
-rw-r--r--basic/source/sbx/sbxbase.cxx11
4 files changed, 16 insertions, 15 deletions
diff --git a/basic/inc/sbxbase.hxx b/basic/inc/sbxbase.hxx
index de1152c921ff..21bb7d4a3686 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 af0c0e808cf8..6b1d5162fd0f 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 9086a05079f2..167433c0af75 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 89cb73564f65..c9ec487f5ebe 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()