[MacRuby-devel] Problems with return code from sheet (possible regression)

Michael Winterstein parzival at mindspring.com
Tue Oct 6 12:58:05 PDT 2009

I seem to have run into nearly the same problem that I had a while  
back, in this ticket:

I haven't filed it yet this time since last time it turned out to be  
already fixed, but I'm not certain that's the case now.  At any rate,  
it's being handled by different functions.
The same thing is happening - the return code being passed to my  
delegate (from [NSApplication endSheet:returnCode]) isn't being  
treated as the NSInteger it ought to be.  At least I think so.  Here's  
the trace, and you can see that the value 1(NSOKButton) is being  
treated as id, causing problems (0/NSCancelButton doesn't crash as  
it's a special case) :

Program received signal:  “EXC_BAD_ACCESS”.
(gdb) bt
#0  rb_ocid_to_rval [inlined] () at /Users/parzival/devo/buried/ 
#1  0x0000000100130161 in rb_vm_ocval_to_rval (ocval=0x1) at  
#2  0x000000010110537c in ?? ()
#3  0x00007fff820c29f9 in -[NSApplication endSheet:returnCode:] ()
#4  0x00007fff81fd523e in -[NSApplication sendAction:to:from:] ()
#5  0x00007fff81fd519d in -[NSControl sendAction:to:] ()
#6  0x00007fff8206068b in -[NSCell  
trackMouse:inRect:ofView:untilMouseUp:] ()
#7  0x00007fff820911a3 in -[NSButtonCell  
trackMouse:inRect:ofView:untilMouseUp:] ()
#8  0x00007fff8205f135 in -[NSControl mouseDown:] ()
#9  0x00007fff81f79967 in -[NSWindow sendEvent:] ()
#10 0x00007fff81eaf122 in -[NSApplication sendEvent:] ()
#11 0x00007fff81e45acc in -[NSApplication run] ()
#12 0x00007fff81e3e798 in NSApplicationMain ()

Attached are a few files as a test case, an NSWindowController  
subclass and MainMenu.nib that can be dropped into a  new project to  
check this if anyone wants to.  I recall when I first had this problem  
that I could see what the change was, but unfortunately I've forgotten  
that now.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20091006/d489c051/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Testfiles.zip
Type: application/zip
Size: 23589 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20091006/d489c051/attachment-0001.zip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20091006/d489c051/attachment-0003.html>

More information about the MacRuby-devel mailing list