summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorBruce Dawson <brucedawson@google.com>2015-01-05 15:31:49 -0800
committerBruce Dawson <brucedawson@google.com>2015-01-05 15:31:49 -0800
commit26d96ff8c617d6a1740db124a4d0208ccb3b74ef (patch)
tree710d56b5fe6a612cc75365b728f7f92a439232af /fpdfsdk/src
parente68d624e4e6c0f2e4197b77e24728c419e6ccf2f (diff)
downloadpdfium-26d96ff8c617d6a1740db124a4d0208ccb3b74ef.tar.xz
XFA: merge patch from CL 832703003, remove g_timeMap global
Get rid of g_timeMap global object. g_timeMap is a global variable with a constructor and destructor so it must be removed. BUG=441899 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/832703003 Review URL: https://codereview.chromium.org/837483006
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Wnd.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
index bc3348736b..69535d7d85 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp
@@ -11,7 +11,12 @@
/* -------------------------- CPWL_Timer -------------------------- */
-static CFX_MapPtrTemplate<FX_INT32, CPWL_Timer*> g_TimeMap;
+static CFX_MapPtrTemplate<FX_INT32, CPWL_Timer*>& GetPWLTimeMap()
+{
+ // Leak the object at shutdown.
+ static auto timeMap = new CFX_MapPtrTemplate<FX_INT32, CPWL_Timer*>;
+ return *timeMap;
+}
CPWL_Timer::CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler) :
m_nTimerID(0),
@@ -31,7 +36,7 @@ FX_INT32 CPWL_Timer::SetPWLTimer(FX_INT32 nElapse)
{
if (m_nTimerID != 0) KillPWLTimer();
m_nTimerID = m_pSystemHandler->SetTimer(nElapse, TimerProc);
- g_TimeMap.SetAt(m_nTimerID, this);
+ GetPWLTimeMap().SetAt(m_nTimerID, this);
return m_nTimerID;
}
@@ -40,7 +45,7 @@ void CPWL_Timer::KillPWLTimer()
if (m_nTimerID != 0)
{
m_pSystemHandler->KillTimer(m_nTimerID);
- g_TimeMap.RemoveKey(m_nTimerID);
+ GetPWLTimeMap().RemoveKey(m_nTimerID);
m_nTimerID = 0;
}
}
@@ -48,7 +53,7 @@ void CPWL_Timer::KillPWLTimer()
void CPWL_Timer::TimerProc(FX_INT32 idEvent)
{
CPWL_Timer* pTimer = NULL;
- if (g_TimeMap.Lookup(idEvent, pTimer))
+ if (GetPWLTimeMap().Lookup(idEvent, pTimer))
{
if (pTimer)
{