diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-03-11 13:10:34 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-03-11 13:11:19 +0000 |
commit | 50d961ebf107bfd3e3a557c4da75bfec2a463408 (patch) | |
tree | f6abb1a1b2c7bf1c679525eef0f2c72412f5eab1 | |
parent | 22cd725fd66f8299f23367a2eac7aaa403ed74aa (diff) |
vcl timers: avoid crash initializing too early.
We need the default instance created first.
Change-Id: I95f51e9ec5d9827f2b1b53bcadb1f43c9e637edd
-rw-r--r-- | include/vcl/timer.hxx | 2 | ||||
-rw-r--r-- | vcl/source/app/timer.cxx | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx index c5849a23cf8b..8ab238a293bd 100644 --- a/include/vcl/timer.hxx +++ b/include/vcl/timer.hxx @@ -35,7 +35,7 @@ protected: virtual sal_uInt64 UpdateMinPeriod( sal_uInt64 nMinPeriod, sal_uInt64 nTime ) SAL_OVERRIDE; private: - void InitSystemTimer(); + static void InitSystemTimer(); public: Timer(); diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx index 565751f0ea0d..a49f4f5ed320 100644 --- a/vcl/source/app/timer.cxx +++ b/vcl/source/app/timer.cxx @@ -27,6 +27,8 @@ void Timer::ImplStartTimer( ImplSVData* pSVData, sal_uInt64 nMS ) { + InitSystemTimer(); + if ( !nMS ) nMS = 1; @@ -101,7 +103,6 @@ Timer::Timer() : Scheduler() mnTimeout = 1; mbAuto = false; mePriority = SchedulerPriority::HIGHEST; - InitSystemTimer(); } Timer::Timer( const Timer& rTimer ) : Scheduler(rTimer) @@ -109,7 +110,6 @@ Timer::Timer( const Timer& rTimer ) : Scheduler(rTimer) mnTimeout = rTimer.mnTimeout; mbAuto = rTimer.mbAuto; maTimeoutHdl = rTimer.maTimeoutHdl; - InitSystemTimer(); } void Timer::Invoke() @@ -122,7 +122,6 @@ void Timer::Start() Scheduler::Start(); ImplSVData* pSVData = ImplGetSVData(); - assert( pSVData->mpSalTimer != NULL ); if ( mnTimeout < pSVData->mnTimerPeriod ) Timer::ImplStartTimer( pSVData, mnTimeout ); } |