Ignore:
Timestamp:
Dec 20, 2005, 12:12:50 PM (19 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by Darin.

  • fixed a leak in the assignment operator from PassRefPtr to RefPtr
  • kxmlcore/RefPtr.h: (KXMLCore::RefPtr::operator=):
  • fix problem with PassRefPtr that darin spotted - it lacked a copy constructor and therefore was using the default one, which can lead to excess derefs

I fixed this by adding a copy constructor from non-const
reference, and by adding a template pass() function that you have
to use when raw pointer or RefPtr are passed where PassRefPtr is
expected.

  • kjs/identifier.cpp: (KJS::Identifier::add): Changed to have PassRefPtr return type and pass() the results.
  • kjs/identifier.h:
  • kjs/property_map.cpp: (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): Use pass() where required.
  • kjs/ustring.cpp: (KJS::UString::UString): Use pass() as needed. (KJS::UString::append): ditto (KJS::UString::substr): ditto
  • kjs/ustring.h: (KJS::UString::UString): Use initializer instead of assignment
  • kxmlcore/PassRefPtr.h: (KXMLCore::PassRefPtr::PassRefPtr): Added copy constructor (KXMLCore::pass): new template function to make it convenient to pass a PassRefPtr

WebCore:

Reviewed by Darin.

  • change an assignment to a contructor declaration to build with PassRefPtr leak fix changes
  • ksvg2/svg/SVGTransformableImpl.cpp: (SVGTransformableImpl::parseTransformAttribute):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/property_map.cpp

    r11527 r11684  
    615615        UString::Rep *key = _singleEntry.key;
    616616        if (key) {
    617             UString k(key);
     617            UString k(pass(key));
    618618            bool fitsInUInt32;
    619619            k.toUInt32(&fitsInUInt32);
    620620            if (fitsInUInt32)
    621                 list.append(Reference(base, Identifier(key)));
     621                list.append(Reference(base, Identifier(pass(key))));
    622622        }
    623623#endif
     
    630630        UString::Rep *key = entries[i].key;
    631631        if (key && key != &UString::Rep::null) {
    632             UString k(key);
     632            UString k(pass(key));
    633633            bool fitsInUInt32;
    634634            k.toUInt32(&fitsInUInt32);
    635635            if (fitsInUInt32)
    636                 list.append(Reference(base, Identifier(key)));
     636                list.append(Reference(base, Identifier(pass(key))));
    637637        }
    638638    }
Note: See TracChangeset for help on using the changeset viewer.