From 2566f386bf0ba1e652524aecb43667d9d8ebd929 Mon Sep 17 00:00:00 2001 From: Jan D Date: Wed, 24 Dec 2014 12:10:01 +0100 Subject: [PATCH] Backport: Don't cache images in nsimage.m (Bug#18918). Fixes: Bug#18918 * nsterm.h (EmacsImage): Remove imageListNext, refCount, reference, imageListSetNext, imageListNext. * nsimage.m (ImageList, imageListNext, imageListSetNext:) (reference): Remove. (allocInitFromFile:): Remove searching ImageList and calling reference (Bug#18918). (dealloc): Remove handling if ImageList. --- src/ChangeLog | 11 ++++++++++ src/nsimage.m | 56 +-------------------------------------------------- src/nsterm.h | 5 ----- 3 files changed, 12 insertions(+), 60 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9aeb8f26152..75545acee90 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2014-11-02 Jan Djärv + + * nsterm.h (EmacsImage): Remove imageListNext, refCount, reference, + imageListSetNext, imageListNext. + + * nsimage.m (ImageList, imageListNext, imageListSetNext:) + (reference): Remove. + (allocInitFromFile:): Remove searching ImageList and calling + reference (Bug#18918). + (dealloc): Remove handling if ImageList. + 2014-12-22 Jan Djärv * xterm.c (do_ewmh_fullscreen): Don't remove maximized_horz/vert diff --git a/src/nsimage.m b/src/nsimage.m index 6b68072b87a..cb29bf1b047 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -160,25 +160,11 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) @implementation EmacsImage -static EmacsImage *ImageList = nil; - + allocInitFromFile: (Lisp_Object)file { - EmacsImage *image = ImageList; NSImageRep *imgRep; Lisp_Object found; - - /* look for an existing image of the same name */ - while (image != nil && - [[image name] compare: [NSString stringWithUTF8String: SSDATA (file)]] - != NSOrderedSame) - image = [image imageListNext]; - - if (image != nil) - { - [image reference]; - return image; - } + EmacsImage *image; /* Search bitmap-file-path for the file, if appropriate. */ found = x_find_image_file (file); @@ -205,54 +191,14 @@ static EmacsImage *ImageList = nil; [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; [image setName: [NSString stringWithUTF8String: SSDATA (file)]]; - [image reference]; - ImageList = [image imageListSetNext: ImageList]; return image; } -- reference -{ - refCount++; - return self; -} - - -- imageListSetNext: (id)arg -{ - imageListNext = arg; - return self; -} - - -- imageListNext -{ - return imageListNext; -} - - - (void)dealloc { - id list = ImageList; - - if (refCount > 1) - { - refCount--; - return; - } - [stippleMask release]; - - if (list == self) - ImageList = imageListNext; - else - { - while (list != nil && [list imageListNext] != self) - list = [list imageListNext]; - [list imageListSetNext: imageListNext]; - } - [super dealloc]; } diff --git a/src/nsterm.h b/src/nsterm.h index 115d7ac6779..aa23e20ee84 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -358,16 +358,11 @@ typedef float EmacsCGFloat; @interface EmacsImage : NSImage { - id imageListNext; - int refCount; NSBitmapImageRep *bmRep; /* used for accessing pixel data */ unsigned char *pixmapData[5]; /* shortcut to access pixel data */ NSColor *stippleMask; } + allocInitFromFile: (Lisp_Object)file; -- reference; -- imageListSetNext: (id)arg; -- imageListNext; - (void)dealloc; - initFromXBM: (unsigned char *)bits width: (int)w height: (int)h flip: (BOOL)flip; -- 2.39.2