summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-05-16 23:43:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-05-20 15:23:08 +0100
commit657d23df43cb643c3b474ebb7b783b86bb436196 (patch)
tree7db20b9e7ea29632d2f9ecc35b704b85f5b4d7d5
parenta0c92c8d310366a9bcf5304d3ac3d88691161079 (diff)
valgrind: make this a well behaved singleton
-rw-r--r--svx/inc/svx/xtable.hxx2
-rw-r--r--svx/source/xoutdev/xtabcolr.cxx13
2 files changed, 4 insertions, 11 deletions
diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx
index 5a26bff796..77eee35f7e 100644
--- a/svx/inc/svx/xtable.hxx
+++ b/svx/inc/svx/xtable.hxx
@@ -316,7 +316,7 @@ public:
virtual sal_Bool CreateBitmapsForUI();
virtual Bitmap* CreateBitmapForUI( long nIndex, sal_Bool bDelete = sal_True );
- static XColorTable* GetStdColorTable();
+ static XColorTable& GetStdColorTable();
};
// -------------------
diff --git a/svx/source/xoutdev/xtabcolr.cxx b/svx/source/xoutdev/xtabcolr.cxx
index 4f3de11c1a..a0c8875bb1 100644
--- a/svx/source/xoutdev/xtabcolr.cxx
+++ b/svx/source/xoutdev/xtabcolr.cxx
@@ -57,12 +57,6 @@ static char const aChckColor[] = { 0x04, 0x00, 'S','O','C','L'}; // < 5.2
static char const aChckColor0[] = { 0x04, 0x00, 'S','O','C','0'}; // = 5.2
static char const aChckXML[] = { '<', '?', 'x', 'm', 'l' }; // = 6.0
-// ------------------
-// class XColorTable
-// ------------------
-
-static XColorTable* pTable=0;
-
/*************************************************************************
|*
|* XColorTable::XColorTable()
@@ -84,11 +78,10 @@ XColorTable::~XColorTable()
{
}
-XColorTable* XColorTable::GetStdColorTable()
+XColorTable& XColorTable::GetStdColorTable()
{
- if ( !pTable )
- pTable = new XColorTable( SvtPathOptions().GetPalettePath() );
- return pTable;
+ static XColorTable aTable(SvtPathOptions().GetPalettePath());
+ return aTable;
}
/************************************************************************/