From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#43973: 28.0.50; [NS] Two crashes on macOS Date: Sat, 2 Jan 2021 18:25:36 +0000 Message-ID: References: <20201014204147.GO60347@breton.holly.idiocy.org> <20201014211548.GP60347@breton.holly.idiocy.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MEWb9LywcnTidT9A" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24157"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43973@debbugs.gnu.org To: Andrii Kolomoiets Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 02 19:26:26 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kvlbe-0006Bl-3k for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Jan 2021 19:26:26 +0100 Original-Received: from localhost ([::1]:47422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kvlbc-00011l-KJ for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Jan 2021 13:26:24 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kvlbG-00011K-MX for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2021 13:26:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49301) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kvlbG-00073c-FP for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2021 13:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kvlbG-0006Gz-C3 for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2021 13:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Jan 2021 18:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43973 X-GNU-PR-Package: emacs Original-Received: via spool by 43973-submit@debbugs.gnu.org id=B43973.160961194724078 (code B ref 43973); Sat, 02 Jan 2021 18:26:02 +0000 Original-Received: (at 43973) by debbugs.gnu.org; 2 Jan 2021 18:25:47 +0000 Original-Received: from localhost ([127.0.0.1]:60843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kvlb1-0006GH-Id for submit@debbugs.gnu.org; Sat, 02 Jan 2021 13:25:47 -0500 Original-Received: from outbound.soverin.net ([116.202.65.218]:33057) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kvlaz-0006G3-FH for 43973@debbugs.gnu.org; Sat, 02 Jan 2021 13:25:46 -0500 Original-Received: from smtp.soverin.net (unknown [10.10.3.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 1E8C86021B for <43973@debbugs.gnu.org>; Sat, 2 Jan 2021 18:25:39 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.142]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1609611938; bh=zrdDYZXfnR8I4cUU4FousOOaRe7Rfy+6yusiKf1fiAI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H6Kv9janAHzK3K1CxjPDGimr+3n5E6JQPuMCYNyopyLVrzFF3Ta+3tsWesGhOUMXA C6zolinB/zSBs0E9g9fyDISr9ahT/htc2Q+xxjZ95SKQC6Vqeb/DJvlXDot/4qmqDP jIFu48cz8TcjeIY9wX4H1Tx4lnujf8zdQqpvOVF7e3hL0kU9T5IDnFxrdLXTmYuLH0 6Zdnb+wZNmnZ8+okkv/hXLXEAKfOnUK0yIR4bJgSPGDmUbAB2MjPo6EKY9Zjoi455P W81iDNTZ0f5BW0M9LYYe+GpIuz58Do9LJ6ALFCkMySyfXnexdoKATb63JMrJpvcC4P ZbZ3BSmlr+A1A== Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id C116520298727C; Sat, 2 Jan 2021 18:25:36 +0000 (GMT) Mail-Followup-To: Alan Third , Andrii Kolomoiets , 43973@debbugs.gnu.org Content-Disposition: inline In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:197212 Archived-At: --MEWb9LywcnTidT9A Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Oct 15, 2020 at 12:33:44AM +0300, Andrii Kolomoiets wrote: > Alan Third writes: > > >> The frame must be small enough to not all the toolbar buttons fits the > >> toolbar: > >> > >> (setq test-frame (make-frame `((parent-frame . ,(selected-frame)) > >> (width . 41)))) > >> > >> The last button (isearch) is replaced by ">>". > > > > Funnily enough that ">>" is what I was looking at. I guess it's a > > toolkit image and not something we provide with Emacs...? > > > >> There are no crash if '(width . 42)'. > > > > Can you try this: Can you please try the attached patch. It looks like NSToolbarItem makes a copy of the image, but EmacsImage is not set up to create copies of itself correctly. -- Alan Third --MEWb9LywcnTidT9A Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-crash-in-NS-toolbar-image-releasing-bug-43973.patch" >From d111484d44744e3f68775a47b7f15ddf0d9b38c0 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sat, 2 Jan 2021 18:19:39 +0000 Subject: [PATCH] Fix crash in NS toolbar image releasing (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 f0014b50b9..fa81a41a51 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -293,6 +293,18 @@ - (void)dealloc } +- (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 -- 2.29.2 --MEWb9LywcnTidT9A--