Bug 1392885 -Add debug message when misusing the guard object. draft
authorJames Cheng <jacheng@mozilla.com>
Wed, 23 Aug 2017 11:59:21 +0800
changeset 651114 14d9346e993838fbdea4af534639cb9289dbce1c
parent 650423 db2a49c83d536d38fad916149e43a8fb35121f82
child 651173 d5b38032a463d5e00130161ede9e5ed1da55e1c1
child 651179 4df306613a71895ed5123f092a808140c4c67b15
push id75593
push userbmo:jacheng@mozilla.com
push dateWed, 23 Aug 2017 07:27:25 +0000
bugs1392885
milestone57.0a1
Bug 1392885 -Add debug message when misusing the guard object. MozReview-Commit-ID: 78iFX5qUcTC
mfbt/GuardObjects.h
--- a/mfbt/GuardObjects.h
+++ b/mfbt/GuardObjects.h
@@ -111,17 +111,17 @@ public:
   GuardObjectNotificationReceiver() : mStatementDone(false) { }
 
   ~GuardObjectNotificationReceiver() {
     /*
      * Assert that the guard object was not used as a temporary.  (Note that
      * this assert might also fire if init is not called because the guard
      * object's implementation is not using the above macros correctly.)
      */
-    MOZ_ASSERT(mStatementDone);
+    MOZ_ASSERT(mStatementDone, "Guard object should not be used as a temporary.");
   }
 
   void init(GuardObjectNotifier& aNotifier)
   {
     aNotifier.setStatementDone(&mStatementDone);
   }
 };