1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-27 23:50:30 -08:00

Backport: Memory leak fix and 19133 fix.

Fixes: debbugs:19133

* nsimage.m (allocInitFromFile:): Initialize bmRep.
(dealloc): Release bmRep.
(setPixmapData): Make bmRep local so class member is not
set.
This commit is contained in:
Jan D 2014-12-24 12:24:14 +01:00
parent bef46ba222
commit 5fc82109ba
2 changed files with 12 additions and 2 deletions

View file

@ -1,4 +1,11 @@
2014-11-02 Jan Djärv <jan.h.d@swipnet.se>
2014-12-24 Jan Djärv <jan.h.d@swipnet.se>
* nsimage.m (allocInitFromFile:): Initialize bmRep.
(dealloc): Release bmRep.
(setPixmapData): Make bmRep local so class member is not
set (Bug#19133).
2014-12-24 Jan Djärv <jan.h.d@swipnet.se>
* nsterm.h (EmacsImage): Remove imageListNext, refCount, reference,
imageListSetNext, imageListNext.

View file

@ -174,6 +174,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
image = [[EmacsImage alloc] initByReferencingFile:
[NSString stringWithUTF8String: SSDATA (found)]];
image->bmRep = nil;
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]];
#else
@ -199,6 +200,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
- (void)dealloc
{
[stippleMask release];
[bmRep release];
[super dealloc];
}
@ -245,6 +247,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
if (s >= bits + length)
{
[bmRep release];
bmRep = nil;
return nil;
}
#define hexchar(x) ('0' <= (x) && (x) <= '9' ? (x) - '0' : (x) - 'a' + 10)
@ -348,7 +351,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
{
if ([rep respondsToSelector: @selector (getBitmapDataPlanes:)])
{
bmRep = (NSBitmapImageRep *) rep;
NSBitmapImageRep *bmRep = (NSBitmapImageRep *) rep;
if ([bmRep numberOfPlanes] >= 3)
[bmRep getBitmapDataPlanes: pixmapData];