mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-05 12:15:32 +00:00
deref CPImage from dom image to prevent memory leak
This commit is contained in:
1 parent
ecee86cc6d
commit
4cb516d8b1
1 file changed
+11
@@ -219,6 +219,7 @@ function CPImageInBundle(aFilename, aSize, aBundle)
|
||||
[self _imageDidLoad];
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
}
|
||||
[self _derefFromImage];
|
||||
}
|
||||
|
||||
_image.onerror = function ()
|
||||
@@ -230,6 +231,7 @@ function CPImageInBundle(aFilename, aSize, aBundle)
|
||||
[self _imageDidError];
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
}
|
||||
[self _derefFromImage];
|
||||
}
|
||||
|
||||
_image.onabort = function ()
|
||||
@@ -241,6 +243,7 @@ function CPImageInBundle(aFilename, aSize, aBundle)
|
||||
[self _imageDidAbort];
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
}
|
||||
[self _derefFromImage];
|
||||
}
|
||||
|
||||
_image.src = _filename;
|
||||
@@ -258,6 +261,14 @@ function CPImageInBundle(aFilename, aSize, aBundle)
|
||||
return NO;
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (void)_derefFromImage
|
||||
{
|
||||
_image.onload = null;
|
||||
_image.onerror = null;
|
||||
_image.onabort = null;
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (void)_imageDidLoad
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user