emacs-diffs
[Top][All Lists]
Advanced

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

master 246803f: Fix image crash on macOS (bug#49688)


From: Alan Third
Subject: master 246803f: Fix image crash on macOS (bug#49688)
Date: Mon, 26 Jul 2021 16:04:26 -0400 (EDT)

branch: master
commit 246803f26fdec5f425418210167da0f93d4b3401
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 3c16cd3..3668a7a 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;
-#ifdef NS_IMPL_COCOA
-  imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]];
-#else
-  imgRep = [image bestRepresentationForDevice: nil];
-#endif
-  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]