Reviewers: Christian Plesner Hansen,

Description:
Destroyed global handles should not be touched.  Added extra
assertions to get errors when first touching the destroyed handle
instead of getting the error when allocating a new handle at some
later point.

Please review this at http://codereview.chromium.org/9741

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/global-handles.cc


Index: src/global-handles.cc
===================================================================
--- src/global-handles.cc       (revision 723)
+++ src/global-handles.cc       (working copy)
@@ -96,6 +96,7 @@
    // Make this handle weak.
    void MakeWeak(void* parameter, WeakReferenceCallback callback) {
      LOG(HandleEvent("GlobalHandle::MakeWeak", handle().location()));
+    ASSERT(state_ != DESTROYED);
      if (state_ != WEAK && !IsNearDeath()) {
        GlobalHandles::number_of_weak_handles_++;
        if (object_->IsJSGlobalObject()) {
@@ -109,6 +110,7 @@

    void ClearWeakness() {
      LOG(HandleEvent("GlobalHandle::ClearWeakness", handle().location()));
+    ASSERT(state_ != DESTROYED);
      if (state_ == WEAK || IsNearDeath()) {
        GlobalHandles::number_of_weak_handles_--;
        if (object_->IsJSGlobalObject()) {



--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to