From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#32812: 27.0.50; macOS Mojave GNU Emacs crash after 5-10 minutes or so Date: Mon, 24 Sep 2018 11:17:06 +0100 Message-ID: <20180924101706.GA24015@breton.holly.idiocy.org> References: <8C435A35-6F98-45D4-AF3E-1052E9420212@apertron.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="PEIAKu/WMn1b1Hv9" Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1537784166 25466 195.159.176.226 (24 Sep 2018 10:16:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 24 Sep 2018 10:16:06 +0000 (UTC) User-Agent: Mutt/1.10.1 (2018-07-13) Cc: 32812@debbugs.gnu.org To: Zack Piper Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 24 12:16:02 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4NuL-0006Va-60 for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Sep 2018 12:16:01 +0200 Original-Received: from localhost ([::1]:44384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4NwR-00056v-IN for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Sep 2018 06:18:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4NwL-00056o-O5 for bug-gnu-emacs@gnu.org; Mon, 24 Sep 2018 06:18:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4NwI-00059M-FR for bug-gnu-emacs@gnu.org; Mon, 24 Sep 2018 06:18:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47107) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g4NwI-000599-9O for bug-gnu-emacs@gnu.org; Mon, 24 Sep 2018 06:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g4NwI-0006WN-3U for bug-gnu-emacs@gnu.org; Mon, 24 Sep 2018 06:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Sep 2018 10:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32812 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32812-submit@debbugs.gnu.org id=B32812.153778423924982 (code B ref 32812); Mon, 24 Sep 2018 10:18:02 +0000 Original-Received: (at 32812) by debbugs.gnu.org; 24 Sep 2018 10:17:19 +0000 Original-Received: from localhost ([127.0.0.1]:51361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4Nva-0006Us-Ks for submit@debbugs.gnu.org; Mon, 24 Sep 2018 06:17:18 -0400 Original-Received: from mail-wm1-f49.google.com ([209.85.128.49]:51335) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4NvY-0006Ue-BB for 32812@debbugs.gnu.org; Mon, 24 Sep 2018 06:17:16 -0400 Original-Received: by mail-wm1-f49.google.com with SMTP id y25-v6so1645801wmi.1 for <32812@debbugs.gnu.org>; Mon, 24 Sep 2018 03:17:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=HTbvse2GL0N4v9ZoRn9hjwsOXfkQy67VmcVdcs5A2pc=; b=cKInaFduhUNVRCpNLpRKxsC6X9DrtBBOXws/e2FO1bQiFazgsxRGZh6RP5hyGjv4Sp pzytRkB05uzPVuubcib6MS1nFiuuS030ZBGbvkDmcvZhW9NitW/1MX+LF6DrZMgh51PM FauzJ8ou9qyG6Y4EtTn0/jiWcCOaATZ1zBzqqFxrSwWODsQ4tm30+XC3Ay1IcnLU/13t EyB1WVk3uxfo+gIZmDgkUKbpB6/vIAygUacZXaBhvFb3LkSd86EUEEtvw6b/yJ8yBqzj aFfTprdSjQ+t9x2kRxsHnOlcWwdUNRYj2cL6uKoFMXLox9rbLa4jscX1heIIIQaajH+l 5ajQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=HTbvse2GL0N4v9ZoRn9hjwsOXfkQy67VmcVdcs5A2pc=; b=RqqUVNFF3CU3t3s//qiaKv2BoAcjGufSbczaTYPoGYlPJle2uf62blT0RGcCHwZVQQ UGs6s9Yf1kQC15ANiJAZMJj29UF9y30V+r3pGyX3QYtV9spzkLUHoJ4yz/yih0UByO7u A5/8/QbLFc1ioKji7TLYvQpRMTLcSYq9OjMpDkXxMR73OpoaAfC6c+cwZry6Zr2QGYv0 kOa+HkK+2M/cPOU2OPv8nqjskBxHJEJZAgRjz/DWbmnOHjyuCikY8Mygpm1Ft5n8BV5y 7WwanHC4ZnE98ed5D20w8opYmbNZi6R8wpW9JvzvT8XMp17iUgxOE9Rfvv7nLZKVCAaO 1Niw== X-Gm-Message-State: ABuFfoj80/AVEVZWAj+0lJYJ4Qaclyw+gUjqOn13uWdBNWSBtjF5A2ip EVLpef8Vm5G75DR4M4m7m6V3ilXi X-Google-Smtp-Source: ACcGV61eHPl79SQ6G/tdBogysqWidGUAOo50wJRIxMDLg2Q1AGHHPPZCreYCiOhtRWBZpVoBRM6t5A== X-Received: by 2002:a1c:950f:: with SMTP id x15-v6mr6311684wmd.157.1537784230432; Mon, 24 Sep 2018 03:17:10 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-685d-0823-64c8-95c1.holly.idiocy.org. [2001:8b0:3f8:8129:685d:823:64c8:95c1]) by smtp.gmail.com with ESMTPSA id h206-v6sm16703397wmf.25.2018.09.24.03.17.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 03:17:08 -0700 (PDT) Content-Disposition: inline In-Reply-To: <8C435A35-6F98-45D4-AF3E-1052E9420212@apertron.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:150593 Archived-At: --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Sun, Sep 23, 2018 at 04:21:13PM +0100, Zack Piper wrote: > Hi! > > (Replacing my post in #31904 with this since they're separate issues(?)) Sorry, I somehow missed that previous email. > I've applied a slightly modified (i.e. updated) version of Alan's patch from > bug #31904 > (attached) to fix an issue concerning the buffer and mode-line not being > rendered. The patch works great, everything is now rendered. > > Now I notice that after 5-10 minutes (or even before), Emacs crashes with > the below: > > ``` > objc[82784]: Invalid or prematurely-freed autorelease pool 0x1030032e0. > ``` > > This started occurring since upgrading to macOS Mojave, so possibly there's > a bug with Mojave or just some incompatibility, not really sure! It’s a bit strange looking, and autorelease pools are something of a mystery to me. I have a suspicion, though, that just creating a new autorelease pool may solve this. I’ve attached a patch. It’s for emacs-26, but should apply OK to master, or without too much work anyway. It simply wraps the call to displayIfNeeded in a new pool: static void ns_flush_display (struct frame *f) /* Force the frame to redisplay. If areas have previously been marked dirty by setNeedsDisplayInRect (in ns_focus), then this will call draw_rect: which will "expose" those areas. */ { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [FRAME_NS_VIEW (f) displayIfNeeded]; [pool release]; } Thanks for testing the patch and raising this issue. There’s not been a lot of feedback so far and I think we’re going to have to commit the patch soon given that Mojave is out today. -- Alan Third --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-crash-when-flushing-to-screen-bug-32812.patch" >From 17bab071cc15aa378e96913ea84167fc4af88f02 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Mon, 24 Sep 2018 11:02:41 +0100 Subject: [PATCH] Fix crash when flushing to screen (bug#32812) * src/nsterm.m (ns_flush_display): Create a new autorelease pool for the display code. --- src/nsterm.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nsterm.m b/src/nsterm.m index b36d847eb3..d6f6d8afee 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1252,7 +1252,9 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) dirty by setNeedsDisplayInRect (in ns_focus), then this will call draw_rect: which will "expose" those areas. */ { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [FRAME_NS_VIEW (f) displayIfNeeded]; + [pool release]; } -- 2.18.0 --PEIAKu/WMn1b1Hv9--