impress195: #i112510# Stop leaking task pane FocusManager singleton.

This commit is contained in:
Andre Fischer
2010-07-14 14:03:14 +02:00
parent a800b0d9fd
commit cff2fd0093
2 changed files with 13 additions and 7 deletions

19
sd/source/ui/toolpanel/TaskPaneFocusManager.cxx Normal file → Executable file
View File

@@ -31,9 +31,9 @@
#include "TaskPaneFocusManager.hxx"
#include <vcl/window.hxx>
#include <vos/mutex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/event.hxx>
#include <rtl/instance.hxx>
#include <hash_map>
namespace {
@@ -70,16 +70,23 @@ class FocusManager::LinkMap
FocusManager* FocusManager::spInstance = NULL;
FocusManager& FocusManager::Instance (void)
{
static FocusManager* spInstance = NULL;
if (spInstance == NULL)
{
::vos::OGuard aGuard (::Application::GetSolarMutex());
::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
if (spInstance == NULL)
spInstance = new FocusManager ();
{
static FocusManager aInstance;
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
spInstance = &aInstance;
}
}
else
{
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
}
return *spInstance;
}

1
sd/source/ui/toolpanel/TaskPaneFocusManager.hxx Normal file → Executable file
View File

@@ -103,7 +103,6 @@ public:
bool TransferFocus (::Window* pSource, const KeyCode& rCode);
private:
static FocusManager* spInstance;
class LinkMap;
::std::auto_ptr<LinkMap> mpLinks;