diff options
| author | Jan D | 2014-12-24 12:24:14 +0100 |
|---|---|---|
| committer | Jan D | 2014-12-24 12:24:14 +0100 |
| commit | 5fc82109bab6f51d8be7134f1368f14c628794e9 (patch) | |
| tree | 135334bdc0a614829ae07dee64dc1d2bf5badeb2 /src | |
| parent | bef46ba222e11e6f9942fae796b42e718317ec0e (diff) | |
| download | emacs-5fc82109bab6f51d8be7134f1368f14c628794e9.tar.gz emacs-5fc82109bab6f51d8be7134f1368f14c628794e9.zip | |
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/ChangeLog | 9 | ||||
| -rw-r--r-- | src/nsimage.m | 5 |
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 @@ | |||
| 1 | 2014-11-02 Jan Djärv <jan.h.d@swipnet.se> | 1 | 2014-12-24 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | |||
| 3 | * nsimage.m (allocInitFromFile:): Initialize bmRep. | ||
| 4 | (dealloc): Release bmRep. | ||
| 5 | (setPixmapData): Make bmRep local so class member is not | ||
| 6 | set (Bug#19133). | ||
| 7 | |||
| 8 | 2014-12-24 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | 9 | ||
| 3 | * nsterm.h (EmacsImage): Remove imageListNext, refCount, reference, | 10 | * nsterm.h (EmacsImage): Remove imageListNext, refCount, reference, |
| 4 | imageListSetNext, imageListNext. | 11 | 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) | |||
| 174 | image = [[EmacsImage alloc] initByReferencingFile: | 174 | image = [[EmacsImage alloc] initByReferencingFile: |
| 175 | [NSString stringWithUTF8String: SSDATA (found)]]; | 175 | [NSString stringWithUTF8String: SSDATA (found)]]; |
| 176 | 176 | ||
| 177 | image->bmRep = nil; | ||
| 177 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 | 178 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 |
| 178 | imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; | 179 | imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; |
| 179 | #else | 180 | #else |
| @@ -199,6 +200,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 199 | - (void)dealloc | 200 | - (void)dealloc |
| 200 | { | 201 | { |
| 201 | [stippleMask release]; | 202 | [stippleMask release]; |
| 203 | [bmRep release]; | ||
| 202 | [super dealloc]; | 204 | [super dealloc]; |
| 203 | } | 205 | } |
| 204 | 206 | ||
| @@ -245,6 +247,7 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 245 | if (s >= bits + length) | 247 | if (s >= bits + length) |
| 246 | { | 248 | { |
| 247 | [bmRep release]; | 249 | [bmRep release]; |
| 250 | bmRep = nil; | ||
| 248 | return nil; | 251 | return nil; |
| 249 | } | 252 | } |
| 250 | #define hexchar(x) ('0' <= (x) && (x) <= '9' ? (x) - '0' : (x) - 'a' + 10) | 253 | #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) | |||
| 348 | { | 351 | { |
| 349 | if ([rep respondsToSelector: @selector (getBitmapDataPlanes:)]) | 352 | if ([rep respondsToSelector: @selector (getBitmapDataPlanes:)]) |
| 350 | { | 353 | { |
| 351 | bmRep = (NSBitmapImageRep *) rep; | 354 | NSBitmapImageRep *bmRep = (NSBitmapImageRep *) rep; |
| 352 | 355 | ||
| 353 | if ([bmRep numberOfPlanes] >= 3) | 356 | if ([bmRep numberOfPlanes] >= 3) |
| 354 | [bmRep getBitmapDataPlanes: pixmapData]; | 357 | [bmRep getBitmapDataPlanes: pixmapData]; |