summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan D <jan.h.d@swipnet.se>2014-12-24 12:24:14 +0100
committerJan D <jan.h.d@swipnet.se>2014-12-24 12:24:14 +0100
commit5fc82109bab6f51d8be7134f1368f14c628794e9 (patch)
tree135334bdc0a614829ae07dee64dc1d2bf5badeb2 /src
parentbef46ba222e11e6f9942fae796b42e718317ec0e (diff)
downloademacs-5fc82109bab6f51d8be7134f1368f14c628794e9.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/nsimage.m5
2 files changed, 12 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f98afd8026f..530b9130783 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/nsimage.m b/src/nsimage.m
index cb29bf1b047..a625f20616d 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -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];