Bug 772987 - Part 3: Update comment in ClearOnShutdown. r=glandium
authorJustin Lebar <justin.lebar@gmail.com>
Thu, 26 Jul 2012 15:33:45 -0400
changeset 100638 7517b13c4d5770d982d7e4e998702303bd661a5e
parent 100637 d5bc3b7322298e4695a309e68f5e75c3d2aace80
child 100639 1b04613c43c92932c856a122f4070d30b546ae04
push id23188
push useremorley@mozilla.com
push dateFri, 27 Jul 2012 08:54:50 +0000
treeherdermozilla-central@399aff2fb74f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs772987
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 772987 - Part 3: Update comment in ClearOnShutdown. r=glandium
xpcom/base/ClearOnShutdown.h
--- a/xpcom/base/ClearOnShutdown.h
+++ b/xpcom/base/ClearOnShutdown.h
@@ -11,24 +11,28 @@
 #include "nsThreadUtils.h"
 
 /*
  * This header exports one public method in the mozilla namespace:
  *
  *   template<class SmartPtr>
  *   void ClearOnShutdown(SmartPtr *aPtr)
  *
- * This function takes a pointer to a smart pointer (i.e., nsCOMPtr<T>*,
- * nsRefPtr<T>*, or nsAutoPtr<T>*) and nulls the smart pointer on shutdown.
+ * This function takes a pointer to a smart pointer and nulls the smart pointer
+ * on shutdown.
  *
  * This is useful if you have a global smart pointer object which you don't
  * want to "leak" on shutdown.
  *
- * There is no way to undo a call to ClearOnShutdown, so you can call it only
- * on smart pointers which you know will live until the program shuts down.
+ * Although ClearOnShutdown will work with any smart pointer (i.e., nsCOMPtr,
+ * nsRefPtr, nsAutoPtr, StaticRefPtr, and StaticAutoPtr), you probably want to
+ * use it only with StaticRefPtr and StaticAutoPtr.  There is no way to undo a
+ * call to ClearOnShutdown, so you can call it only on smart pointers which you
+ * know will live until the program shuts down.  In practice, these are likely
+ * global variables, which should be Static{Ref,Auto}Ptr.
  *
  * ClearOnShutdown is currently main-thread only because we don't want to
  * accidentally free an object from a different thread than the one it was
  * created on.
  */
 
 namespace mozilla {
 namespace ClearOnShutdown_Internal {