[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/ns/refactor 0132e0a 12/12: Fix image crash on macOS (bug#49688)

From: Alan Third
Subject: scratch/ns/refactor 0132e0a 12/12: Fix image crash on macOS (bug#49688)
Date: Sat, 24 Jul 2021 11:40:05 -0400 (EDT)

branch: scratch/ns/refactor
commit 0132e0a1a9365cb99b9bee24607356884bb8648e
Author: Alan Third <alan@idiocy.org>
Commit: Alan Third <alan@idiocy.org>

    Fix image crash on macOS (bug#49688)
    * src/nsimage.m ([EmacsImage allocInitFromFile:]): Use isValid to
    check whether the image is valid instead of generating a tiff.
 src/nsimage.m | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/nsimage.m b/src/nsimage.m
index bd01a51..dd2bb3b 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -265,16 +265,12 @@ ns_image_size_in_bytes (void *img)
   image = [[EmacsImage alloc] initByReferencingFile:filename];
   image->bmRep = nil;
-  imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]];
-  imgRep = [image bestRepresentationForDevice: nil];
-  if (imgRep == nil)
+  if (![image isValid])
       [image release];
       return nil;
+  imgRep = [[image representations] firstObject];
   [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])];
   [image setName:filename];

reply via email to

[Prev in Thread] Current Thread [Next in Thread]