Ticket #846: memleak-scriptableobject.patch
File memleak-scriptableobject.patch, 1.4 KB (added by , 11 years ago) |
---|
-
trunk/source/scripting/ScriptableObject.h
a b 320 320 } 321 321 static void AddProperty( const CStrW& PropertyName, TGetFn Getter, TSetFn Setter = NULL ) 322 322 { 323 if (m_NativeProperties.count(PropertyName)) 324 delete m_NativeProperties[PropertyName]; 325 323 326 m_NativeProperties[PropertyName] = new CJSFunctionProperty( (GetFn)Getter, (SetFn)Setter ); 324 327 } 325 328 template<typename ReturnType, ReturnType (T::*NativeFunction)( JSContext* cx, uintN argc, jsval* argv )> … … 332 335 { 333 336 IJSProperty* prop; 334 337 if( PropReadOnly ) 335 {336 338 prop = new CJSProperty<PropType, true>( (PropType IJSObject::*)Native ); 337 }338 339 else 339 {340 340 prop = new CJSProperty<PropType, ReadOnly>( (PropType IJSObject::*)Native ); 341 } 341 342 if (m_NativeProperties.count(PropertyName)) 343 delete m_NativeProperties[PropertyName]; 344 342 345 m_NativeProperties[PropertyName] = prop; 343 346 } 344 347 #ifdef ALLOW_NONSHARED_NATIVES … … 346 349 { 347 350 IJSProperty* prop; 348 351 if( PropReadOnly ) 349 {350 352 prop = new CJSNonsharedProperty<PropType, true>( Native ); 351 }352 353 else 353 354 prop = new CJSNonsharedProperty<PropType, ReadOnly>( Native ); 355 356 if (m_NonsharedProperties.count(PropertyName)) 357 delete m_NonsharedProperties[PropertyName]; 358 354 359 m_NonsharedProperties[PropertyName] = prop; 355 360 } 356 361 #endif