unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Bug#23924 - crashes on next OS X release
Date: Fri, 22 Jul 2016 22:54:16 +0100	[thread overview]
Message-ID: <20160722215416.GA17147@breton.holly.idiocy.org> (raw)
In-Reply-To: <20160718190346.GA11206@breton.holly.idiocy.org>

[-- Attachment #1: Type: text/plain, Size: 1605 bytes --]

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 <eliz@gnu.org> 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

[-- Attachment #2: patch for bug#23924 --]
[-- Type: text/plain, Size: 2248 bytes --]

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 <alan@idiocy.org>
Date: Wed, 20 Jul 2016 21:59:17 +0100
Subject: [PATCH] Post AppDefined events from the main thread ONLY (bug#23934)
To: Bob Halley <halley@play-bow.org>
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


  parent reply	other threads:[~2016-07-22 21:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18 14:02 Bug#23924 - crashes on next OS X release Alan Third
2016-07-18 14:49 ` Eli Zaretskii
2016-07-18 16:16   ` John Wiegley
2016-07-18 19:03     ` Alan Third
2016-07-19 23:28       ` David Caldwell
2016-07-22 21:54       ` Alan Third [this message]
2016-08-02 14:59         ` Alan Third
2016-08-02 20:25           ` John Wiegley
2016-08-03  2:37             ` Eli Zaretskii
2016-08-03  7:07               ` Marius Kjeldahl
2016-08-03  8:39                 ` Alan Third
2016-08-03 16:57                   ` Alan Third
2016-08-03 19:50                     ` Nicolas Petton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160722215416.GA17147@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).