diff options
| author | Alan Third | 2021-07-24 12:44:19 +0100 |
|---|---|---|
| committer | Alan Third | 2021-07-24 16:35:46 +0100 |
| commit | 0132e0a1a9365cb99b9bee24607356884bb8648e (patch) | |
| tree | 69ed3bc641edd31d4755f3a729806ca7d487f96e /src | |
| parent | 361d0438681565249132fd74932dd1783bccb978 (diff) | |
| download | emacs-scratch/ns/refactor.tar.gz emacs-scratch/ns/refactor.zip | |
Fix image crash on macOS (bug#49688)scratch/ns/refactor
* src/nsimage.m ([EmacsImage allocInitFromFile:]): Use isValid to
check whether the image is valid instead of generating a tiff.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsimage.m | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/nsimage.m b/src/nsimage.m index bd01a515c6c..dd2bb3b0d7b 100644 --- a/src/nsimage.m +++ b/src/nsimage.m | |||
| @@ -265,16 +265,12 @@ ns_image_size_in_bytes (void *img) | |||
| 265 | image = [[EmacsImage alloc] initByReferencingFile:filename]; | 265 | image = [[EmacsImage alloc] initByReferencingFile:filename]; |
| 266 | 266 | ||
| 267 | image->bmRep = nil; | 267 | image->bmRep = nil; |
| 268 | #ifdef NS_IMPL_COCOA | 268 | if (![image isValid]) |
| 269 | imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; | ||
| 270 | #else | ||
| 271 | imgRep = [image bestRepresentationForDevice: nil]; | ||
| 272 | #endif | ||
| 273 | if (imgRep == nil) | ||
| 274 | { | 269 | { |
| 275 | [image release]; | 270 | [image release]; |
| 276 | return nil; | 271 | return nil; |
| 277 | } | 272 | } |
| 273 | imgRep = [[image representations] firstObject]; | ||
| 278 | 274 | ||
| 279 | [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; | 275 | [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; |
| 280 | [image setName:filename]; | 276 | [image setName:filename]; |