Bug 1036367 - Fix dangerous public destructors in purple/, followup to fix array class. r=florian
authoraleth <aleth@instantbird.org>
Sat, 12 Jul 2014 21:42:12 +0200
changeset 739 956f01125ef6e067196fe4a9d40fc58170055a45
parent 738 890a12044644de90709937000071a76dd51442c7
child 740 e69eedb84ede0de75f4a1e394ea14aa37abc87d8
push id19
push useraleth@instantbird.org
push dateSat, 12 Jul 2014 19:42:37 +0000
reviewersflorian
bugs1036367
Bug 1036367 - Fix dangerous public destructors in purple/, followup to fix array class. r=florian
purplexpcom/src/purpleTimer.cpp
purplexpcom/src/purpleTimer.h
--- a/purplexpcom/src/purpleTimer.cpp
+++ b/purplexpcom/src/purpleTimer.cpp
@@ -17,25 +17,25 @@
 // NSPR_LOG_MODULES=purpleTimer:5
 //
 static PRLogModuleInfo *gPurpleTimerLog = nullptr;
 #endif
 #define LOG(args) PR_LOG(gPurpleTimerLog, PR_LOG_DEBUG, args)
 
 /* Init static members */
 PRUint32 purpleTimer::sLastTimer = 0;
-nsCOMArray<purpleTimeout> *purpleTimer::sTimeouts = nullptr;
+nsTArray<nsRefPtr<purpleTimeout> > *purpleTimer::sTimeouts = nullptr;
 
 void purpleTimer::init()
 {
 #ifdef PR_LOGGING
   if (!gPurpleTimerLog)
     gPurpleTimerLog = PR_NewLogModule("purpleTimer");
 #endif
-  sTimeouts = new nsCOMArray<purpleTimeout>();
+  sTimeouts = new nsTArray<nsRefPtr<purpleTimeout> >();
 }
 
 void purpleTimer::unInit()
 {
   LOG(("purpleTimer::unInit: removing %i leftover timeouts",
        sTimeouts->Length()));
 
   for (PRUint32 i = 0; i < sTimeouts->Length(); ++i) {
--- a/purplexpcom/src/purpleTimer.h
+++ b/purplexpcom/src/purpleTimer.h
@@ -1,14 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include<nsCOMPtr.h>
-#include "nsCOMArray.h"
+#include <nsCOMPtr.h>
+#include "nsTArray.h"
 #include <glib.h>
 #include <nsITimer.h>
 
 #include <nsIRunnable.h>
 class purpleTimeout MOZ_FINAL : public nsIRunnable
 {
  public:
   NS_DECL_THREADSAFE_ISUPPORTS
@@ -35,11 +35,11 @@ class purpleTimer
   static PRUint32 AddTimeout(PRUint32 aInterval,
                              GSourceFunc aFunction,
                              gpointer aData);
   static void ExecTimer(nsITimer *aTimer, void *aTimerClosure);
   static gboolean CancelTimer(PRUint32 aId);
   static nsresult CancelTimerFromAccountId(PRUint32 aAccountId);
 
  private:
-  static nsCOMArray<purpleTimeout> *sTimeouts;
+  static nsTArray<nsRefPtr<purpleTimeout> > *sTimeouts;
   static PRUint32 sLastTimer;
 };