Commit 5fc82109 authored by Jan D's avatar Jan D

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.
parent bef46ba2
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, * nsterm.h (EmacsImage): Remove imageListNext, refCount, reference,
imageListSetNext, imageListNext. imageListSetNext, imageListNext.
......
...@@ -174,6 +174,7 @@ @implementation EmacsImage ...@@ -174,6 +174,7 @@ @implementation EmacsImage
image = [[EmacsImage alloc] initByReferencingFile: image = [[EmacsImage alloc] initByReferencingFile:
[NSString stringWithUTF8String: SSDATA (found)]]; [NSString stringWithUTF8String: SSDATA (found)]];
image->bmRep = nil;
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]];
#else #else
...@@ -199,6 +200,7 @@ @implementation EmacsImage ...@@ -199,6 +200,7 @@ @implementation EmacsImage
- (void)dealloc - (void)dealloc
{ {
[stippleMask release]; [stippleMask release];
[bmRep release];
[super dealloc]; [super dealloc];
} }
...@@ -245,6 +247,7 @@ - (void)dealloc ...@@ -245,6 +247,7 @@ - (void)dealloc
if (s >= bits + length) if (s >= bits + length)
{ {
[bmRep release]; [bmRep release];
bmRep = nil;
return nil; return nil;
} }
#define hexchar(x) ('0' <= (x) && (x) <= '9' ? (x) - '0' : (x) - 'a' + 10) #define hexchar(x) ('0' <= (x) && (x) <= '9' ? (x) - '0' : (x) - 'a' + 10)
...@@ -348,7 +351,7 @@ - (void) setPixmapData ...@@ -348,7 +351,7 @@ - (void) setPixmapData
{ {
if ([rep respondsToSelector: @selector (getBitmapDataPlanes:)]) if ([rep respondsToSelector: @selector (getBitmapDataPlanes:)])
{ {
bmRep = (NSBitmapImageRep *) rep; NSBitmapImageRep *bmRep = (NSBitmapImageRep *) rep;
if ([bmRep numberOfPlanes] >= 3) if ([bmRep numberOfPlanes] >= 3)
[bmRep getBitmapDataPlanes: pixmapData]; [bmRep getBitmapDataPlanes: pixmapData];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment