emacs-diffs
[Top][All Lists]
Advanced

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

master d84cf78 1/2: Fix NS toolbar image release crash (bug#43973)


From: Alan Third
Subject: master d84cf78 1/2: Fix NS toolbar image release crash (bug#43973)
Date: Sat, 2 Jan 2021 17:32:40 -0500 (EST)

branch: master
commit d84cf78df8ea5d99cc5b38c49f3b7aed081170f5
Author: Alan Third <alan@idiocy.org>
Commit: Alan Third <alan@idiocy.org>

    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.
---
 src/nsimage.m | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/nsimage.m b/src/nsimage.m
index f0014b5..fa81a41 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -293,6 +293,18 @@ ns_image_size_in_bytes (void *img)
 }
 
 
+- (id)copyWithZone:(NSZone *)zone
+{
+  EmacsImage *copy = [super copyWithZone:zone];
+
+  copy->stippleMask = [stippleMask copyWithZone:zone];
+  copy->bmRep = [bmRep copyWithZone:zone];
+  copy->transform = [transform copyWithZone:zone];
+
+  return copy;
+}
+
+
 /* Create image from monochrome bitmap. If both FG and BG are 0
    (black), set the background to white and make it transparent.  */
 - (instancetype)initFromXBM: (unsigned char *)bits width: (int)w height: (int)h



reply via email to

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