Subject: Re: bug#5811: 23.1.94; Emacs Nextstep port crashes after graphical yes-or-no-p

From: Adrian Robert <[email-masked]>
Date: Sat, 10 Apr 2010 09:11:43 +0300

On Apr 6, 2010, at 4:17 PM, Adrian Robert wrote:

>> Maybe you made a 32bit binary?
>> 
>> When I compile with
>> 
>> CC="gcc -arch i386" ./configure --with-ns
>> 
>> the resulting binary does not crash on the test case. So it appears to
>> be a problem with 64bit only.
> 
> Hmm, possibly.  Anyway this suggests maybe it is also some sort of signature and/or argument-passing issue.  The previous fix just corrected some kind misalignment problem due to the wrong size for the return type being allocated on the stack.

This is roughly what it seemed to be.  Here is a patch that fixes this issue for me running 10.6.2 64-bit.  (I tried to look for other problems of this sort in the source but did not find any -- though that doesn't mean they don't exist!)

-Adrian

Index: nsmenu.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsmenu.m,v
retrieving revision 1.31
diff -u -p -r1.31 nsmenu.m
--- nsmenu.m	9 Nov 2009 06:21:03 -0000	1.31
+++ nsmenu.m	10 Apr 2010 06:09:44 -0000
@@ -1709,7 +1709,7 @@ void process_dialog (id window, Lisp_Obj
 
 - (Lisp_Object)runDialogAt: (NSPoint)p
 {
-  int ret;
+  NSInteger ret;
   extern EMACS_TIME timer_check (int do_it_now); /* TODO: add to a header */
 
   /* initiate a session that will be ended by pop_down_menu */