Bug 792065 - Uninitialised value use in nsIdleServiceDaily::DailyCallback. r=roc
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Thu, 20 Sep 2012 11:37:56 +0200
changeset 107731 22f69ef21a70cdac569338cfa81e9737511762c2
parent 107730 0d016659bfcdb87c618c485f18dd3ac4d4d46c72
child 107732 8656e7a77c0ec61a9ca40e92929be8634bcc875c
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersroc
bugs792065
milestone18.0a1
Bug 792065 - Uninitialised value use in nsIdleServiceDaily::DailyCallback. r=roc
widget/xpwidgets/nsIdleService.cpp
--- a/widget/xpwidgets/nsIdleService.cpp
+++ b/widget/xpwidgets/nsIdleService.cpp
@@ -144,16 +144,20 @@ nsIdleServiceDaily::Init()
     lastDaily = 0;
   }
 
   // Check if it has been a day since the last notification.
   if (nowSec - lastDaily > SECONDS_PER_DAY) {
 #ifdef ANDROID
     __android_log_print(ANDROID_LOG_INFO, "IdleService", "DailyCallback started");
 #endif
+    // The timer would have been started after the previous idle-daily. Need to
+    // set this here so DailyCallback knows the timer didn't fire early.
+    mDailyTimerStart = lastDaily * PR_USEC_PER_SEC;
+
     // Wait for the user to become idle, so we can do todays idle tasks.
     DailyCallback(nullptr, this);
   }
   else {
 #ifdef ANDROID
     __android_log_print(ANDROID_LOG_INFO, "IdleService", "Setting timer a day from now");
 #endif