diff options
| author | Alan Third | 2021-01-02 18:19:39 +0000 |
|---|---|---|
| committer | Alan Third | 2021-01-02 22:29:54 +0000 |
| commit | d84cf78df8ea5d99cc5b38c49f3b7aed081170f5 (patch) | |
| tree | 70eec34e20ca9fbf30374e93cdf102045616c10e /src | |
| parent | dde3269633550debb8b13cdc77136fe638c8e1fc (diff) | |
| download | emacs-d84cf78df8ea5d99cc5b38c49f3b7aed081170f5.tar.gz emacs-d84cf78df8ea5d99cc5b38c49f3b7aed081170f5.zip | |
Fix NS toolbar image release crash (bug#43973)
The toolbar fails to make a proper copy of EmacsImage objects, so
releasing the copy incorrectly released instance variables from the
original objects.
* src/nsimage.m ([EmacsImage copyWithZone:]): New function to enable
correct copying of EmacsImage.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsimage.m | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nsimage.m b/src/nsimage.m index f0014b50b9b..fa81a41a519 100644 --- a/src/nsimage.m +++ b/src/nsimage.m | |||
| @@ -293,6 +293,18 @@ ns_image_size_in_bytes (void *img) | |||
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | 295 | ||
| 296 | - (id)copyWithZone:(NSZone *)zone | ||
| 297 | { | ||
| 298 | EmacsImage *copy = [super copyWithZone:zone]; | ||
| 299 | |||
| 300 | copy->stippleMask = [stippleMask copyWithZone:zone]; | ||
| 301 | copy->bmRep = [bmRep copyWithZone:zone]; | ||
| 302 | copy->transform = [transform copyWithZone:zone]; | ||
| 303 | |||
| 304 | return copy; | ||
| 305 | } | ||
| 306 | |||
| 307 | |||
| 296 | /* Create image from monochrome bitmap. If both FG and BG are 0 | 308 | /* Create image from monochrome bitmap. If both FG and BG are 0 |
| 297 | (black), set the background to white and make it transparent. */ | 309 | (black), set the background to white and make it transparent. */ |
| 298 | - (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h | 310 | - (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h |