Bug 718999 - make "You can't dereference a NULL nsCOMPtr" assertions fatal.
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 24 Jan 2012 20:37:48 +0100
changeset 85265 0a116f325333e5db37cb9cc2afff622bfd7bc564
parent 85264 ddba5171787231891f5d600841921342b088ee68
child 85266 f35bd9404ee494995c7af90221a1aa6f4f5128f8
push id21915
push userbmo@edmorley.co.uk
push dateWed, 25 Jan 2012 14:16:23 +0000
treeherdermozilla-central@0d5ad6a6f814 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs718999
milestone12.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 718999 - make "You can't dereference a NULL nsCOMPtr" assertions fatal. r=bsmedberg
xpcom/glue/nsCOMPtr.h
--- a/xpcom/glue/nsCOMPtr.h
+++ b/xpcom/glue/nsCOMPtr.h
@@ -53,17 +53,17 @@
                        -- scc
 */
 
 #include "mozilla/Attributes.h"
 
   // Wrapping includes can speed up compiles (see "Large Scale C++ Software Design")
 #ifndef nsDebug_h___
 #include "nsDebug.h"
-  // for |NS_PRECONDITION|
+  // for |NS_ABORT_IF_FALSE|, |NS_ASSERTION|
 #endif
 
 #ifndef nsISupportsUtils_h__
 #include "nsISupportsUtils.h"
   // for |nsresult|, |NS_ADDREF|, |NS_GET_TEMPLATE_IID| et al
 #endif
 
 #ifndef nscore_h___
@@ -801,17 +801,17 @@ class nsCOMPtr MOZ_FINAL
           */
         {
           return get();
         }
 
       T*
       operator->() const
         {
-          NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator->().");
+          NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator->().");
           return get();
         }
 
       nsCOMPtr<T>*
       get_address()
           // This is not intended to be used by clients.  See |address_of|
           // below.
         {
@@ -825,17 +825,17 @@ class nsCOMPtr MOZ_FINAL
         {
           return this;
         }
 
     public:
       T&
       operator*() const
         {
-          NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator*().");
+          NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator*().");
           return *get();
         }
 
       T**
       StartAssignment()
         {
 #ifndef NSCAP_FEATURE_INLINE_STARTASSIGNMENT
           return reinterpret_cast<T**>(begin_assignment());
@@ -1108,17 +1108,17 @@ class nsCOMPtr<nsISupports>
           */
         {
           return get();
         }
 
       nsISupports*
       operator->() const
         {
-          NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator->().");
+          NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator->().");
           return get();
         }
 
       nsCOMPtr<nsISupports>*
       get_address()
           // This is not intended to be used by clients.  See |address_of|
           // below.
         {
@@ -1133,17 +1133,17 @@ class nsCOMPtr<nsISupports>
           return this;
         }
 
     public:
 
       nsISupports&
       operator*() const
         {
-          NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator*().");
+          NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator*().");
           return *get();
         }
 
       nsISupports**
       StartAssignment()
         {
 #ifndef NSCAP_FEATURE_INLINE_STARTASSIGNMENT
           return reinterpret_cast<nsISupports**>(begin_assignment());