From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: Bug#23924 - crashes on next OS X release Date: Fri, 22 Jul 2016 22:54:16 +0100 Message-ID: <20160722215416.GA17147@breton.holly.idiocy.org> References: <83shv70zn5.fsf@gnu.org> <20160718190346.GA11206@breton.holly.idiocy.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="OXfL5xGRrasGEqWY" Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1469224476 16347 80.91.229.3 (22 Jul 2016 21:54:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Jul 2016 21:54:36 +0000 (UTC) To: Eli Zaretskii , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 22 23:54:32 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bQiOr-000689-OJ for ged-emacs-devel@m.gmane.org; Fri, 22 Jul 2016 23:54:30 +0200 Original-Received: from localhost ([::1]:49461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQiOq-0003cz-JW for ged-emacs-devel@m.gmane.org; Fri, 22 Jul 2016 17:54:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQiOk-0003ct-HY for emacs-devel@gnu.org; Fri, 22 Jul 2016 17:54:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQiOi-00029q-FI for emacs-devel@gnu.org; Fri, 22 Jul 2016 17:54:21 -0400 Original-Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:36879) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQiOf-00029S-Ah; Fri, 22 Jul 2016 17:54:17 -0400 Original-Received: by mail-wm0-x232.google.com with SMTP id i5so82952793wmg.0; Fri, 22 Jul 2016 14:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=sender:date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=tS49qQ6EEkLc0qJNnILnxzKBVX329Wvo3y9LAs567W8=; b=vMV+m/CtGYWCDWItKG+1XnfpfOzTNN3wWj6EkNqezkWcjtAXn2HrIOun8FkUYx+pbx aafTS1mgLarhKQk+uc7Dw85OBRcnj+nEIkjGaVbrYnvOId11GcrxEoEMw57C9lkqwIZQ hvM6scwnxYz+zyFn2jj6QFBe53/uIhxGWINLFvIaqqsIAWxtVgF5MsTbymwV2lhwjS1+ utn3OQLEbvlW5u3tQl16VkM1Xt2DIuWiiYLj3e6XDMXnu/TGhHPUtmRkqMg3yZTLhgIo INpS871laM+P2QG1gEMYJAaLnwnPcsz725P5d/RHikOSA26UuQ4SqwLKn8YEQi3LGOvd Ldew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=tS49qQ6EEkLc0qJNnILnxzKBVX329Wvo3y9LAs567W8=; b=mvAe11VTHPgyVOtNl/3MuDq6glIr92h7zrMFkGOvZpZX108ycmH/RzAvE3kCaiISbr KhrMhvHKlcmquZunyZQ4Yl1Uzd48X8UP6C0HPnF9kBFdki7EVODKRQBkYcnuyNXBOwZF cgJuNp+o1a/DrrvYJmL6tVHS5116kHodNc9tHi/WM2vSv5oU9eG7c5BZLXE1JnpvECqu rg4awrG0F5D4JZzpJ2wNLM3UVKymvghPrMkRkybydjKToqktsX/Y7OMglm6rNQ+a8Zni +Ia3UPV4XVdHdwwuFZAykR4hvUEHGjHWAmxOgM9h4HIP1b8JffEO+RBKufPXGhxQxhrP P3CQ== X-Gm-Message-State: ALyK8tJs1brGuSpU1D2M7wh8sSKb8lxXIwUauOgH4h2gBUpSuKl3FTMwE8bniFZpbbAjiw== X-Received: by 10.28.148.148 with SMTP id w142mr28864336wmd.48.1469224455954; Fri, 22 Jul 2016 14:54:15 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-3c58-f213-3cd9-9a60.holly.idiocy.org. [2001:8b0:3f8:8129:3c58:f213:3cd9:9a60]) by smtp.gmail.com with ESMTPSA id u125sm14379845wmg.22.2016.07.22.14.54.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jul 2016 14:54:15 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20160718190346.GA11206@breton.holly.idiocy.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::232 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:206052 Archived-At: --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Mon, Jul 18, 2016 at 08:03:46PM +0100, Alan Third wrote: > On Mon, Jul 18, 2016 at 09:16:09AM -0700, John Wiegley wrote: > > >>>>> "EZ" == Eli Zaretskii writes: > > > > EZ> If you are confident that it won't do any trouble, and that 10.10, and > > EZ> only that version, needs this fix, feel free to push to emacs-25. > > > > Before you do, can you show us the patch here so that I can have a sense of > > what it changes? I've been running emacs-25 crash-free on 10.11 for many > > months now. > > I’m not that confident as I couldn’t find anything about the bug in > question except what was in the bug report and comment in the code. I > tried removing the fix and can’t reproduce the original problem on > 10.11. It’s possible it’s actually been fixed in later releases of > 10.10 too. I’ve got a new patch. One of the testers of the first patch ran into bug#18993, so it’s clearly still an issue, and further investigation leaves me suspecting that, contrary to the bug report thread, it’s not an OS X bug, but something to do with how Emacs is handling events. The new patch leaves the fix in place and uses an existing GNUStep fix to ensure that postEvent always runs in the main thread. That fixes bug#23924. There’s probably an argument to be made that we should fix 18993 properly, but I don’t think we have anyone who knows the NS port well enough to do it, as it would require a substantial rewrite of the event loop. If this is to be applied to Emacs 25, let me know if it’s to go to master too. I’m unsure how it’s handled. -- Alan Third --OXfL5xGRrasGEqWY Content-Type: text/plain; charset=us-ascii Content-Description: patch for bug#23924 Content-Disposition: attachment; filename="0001-Post-AppDefined-events-from-the-main-thread-ONLY-bug.patch" >From 50d21628a5288420ead32ba97731a496101289b5 Mon Sep 17 00:00:00 2001 In-Reply-To: <6629E4B5-5D34-4840-B0A1-A62BA025C472@play-bow.org> References: <6629E4B5-5D34-4840-B0A1-A62BA025C472@play-bow.org> From: Alan Third Date: Wed, 20 Jul 2016 21:59:17 +0100 Subject: [PATCH] Post AppDefined events from the main thread ONLY (bug#23934) To: Bob Halley Cc: 23924@debbugs.gnu.org * src/nsterm.h: Make nextappdefined var not just GNUStep. * src/nsterm.c (ns_send_appdefined, sendFromMainThread): Remove GNUStep --- src/nsterm.h | 2 +- src/nsterm.m | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/nsterm.h b/src/nsterm.h index 862ff2e..3d8b1a1 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -380,9 +380,9 @@ char const * nstrace_fullscreen_type_name (int); #endif #ifdef NS_IMPL_GNUSTEP BOOL applicationDidFinishLaunchingCalled; +#endif @public int nextappdefined; -#endif } - (void)logNotification: (NSNotification *)notification; - (void)antialiasThresholdDidChange:(NSNotification *)notification; diff --git a/src/nsterm.m b/src/nsterm.m index 8da2ffe..dcc1e87 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -3927,8 +3927,8 @@ overwriting cursor (usually when cursor on a tab) */ { NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_send_appdefined(%d)", value); -#ifdef NS_IMPL_GNUSTEP // GNUstep needs postEvent to happen on the main thread. + // Cocoa needs nextEventMatchingMask to happen on the main thread too. if (! [[NSThread currentThread] isMainThread]) { EmacsApp *app = (EmacsApp *)NSApp; @@ -3938,7 +3938,6 @@ overwriting cursor (usually when cursor on a tab) */ waitUntilDone:YES]; return; } -#endif /* Only post this event if we haven't already posted one. This will end the [NXApp run] main loop after having processed all events queued at @@ -5551,12 +5550,10 @@ - (void)timeout_handler: (NSTimer *)timedEntry ns_send_appdefined (-2); } -#ifdef NS_IMPL_GNUSTEP - (void)sendFromMainThread:(id)unused { ns_send_appdefined (nextappdefined); } -#endif - (void)fd_handler:(id)unused /* -------------------------------------------------------------------------- -- 2.7.4 --OXfL5xGRrasGEqWY--