bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#49688: 28.0.50; Attempting to show images crashes Emacs


From: Alan Third
Subject: bug#49688: 28.0.50; Attempting to show images crashes Emacs
Date: Sat, 24 Jul 2021 00:27:59 +0100

On Sat, Jul 24, 2021 at 12:52:15AM +0200, Rudolf Adamkovič wrote:
> I applied the patch using the “patch” command, and then I recompiled:
> 
> ./configure --with-xwidgets --with-json --with-native-compilation
> make
> make install
> 
> (Notice, no --without-native-image-api.)
> 
> If what I did was correct, then the result is as follows:
> 
> - Emacs does not crash. Good!
> - The images have strange sizes. Oops!

What about this instead:

modified   src/nsimage.m
@@ -265,16 +265,12 @@ + (instancetype)allocInitFromFile: (Lisp_Object)file
   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];

-- 
Alan Third





reply via email to

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