Ignore:
Timestamp:
Apr 14, 2008, 11:48:16 AM (17 years ago)
Author:
[email protected]
Message:

2008-04-14 Anders Carlsson <[email protected]>

Reviewed by Adam.

Don't leak the prototype class.


  • API/JSClassRef.cpp: (OpaqueJSClass::create):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSClassRef.cpp

    r30413 r31872  
    118118        protoDefinition.staticFunctions = staticFunctions;
    119119        protoDefinition.finalize = clearReferenceToPrototype;
    120         OpaqueJSClass* protoClass = new OpaqueJSClass(&protoDefinition, 0);
     120       
     121        // We are supposed to use JSClassRetain/Release but since we know that we currently have
     122        // the only reference to this class object we cheat and use a RefPtr instead.
     123        RefPtr<OpaqueJSClass> protoClass = adoptRef(new OpaqueJSClass(&protoDefinition, 0));
    121124
    122125        // remove functions from the original class
    123126        JSClassDefinition objectDefinition = *definition;
    124127        objectDefinition.staticFunctions = 0;
    125         return adoptRef(new OpaqueJSClass(&objectDefinition, protoClass));
     128
     129        return adoptRef(new OpaqueJSClass(&objectDefinition, protoClass.get()));
    126130    }
    127131
Note: See TracChangeset for help on using the changeset viewer.