Problems with return code from sheet (possible regression)
I seem to have run into nearly the same problem that I had a while back, in this ticket: http://www.macruby.org/trac/ticket/221 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/ MacRuby/trunk/include/ruby/ruby.h:1252 #1 0x0000000100130161 in rb_vm_ocval_to_rval (ocval=0x1) at compiler.cpp:6155 #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.
Hi Michael, It's actually a well-known bug. MacRuby trunk doesn't honor the sel_of_type BridgeSupport attribute, therefore your sheet callback is registered to the runtime with the default signature (where all arguments and return value are Objective-C objects), and later it fails to convert the returnCode argument (in this backtrace, 0x1) as an Objective-C object. Laurent On Oct 6, 2009, at 12:58 PM, Michael Winterstein wrote:
I seem to have run into nearly the same problem that I had a while back, in this ticket: http://www.macruby.org/trac/ticket/221
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/ MacRuby/trunk/include/ruby/ruby.h:1252 #1 0x0000000100130161 in rb_vm_ocval_to_rval (ocval=0x1) at compiler.cpp:6155 #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. <Testfiles.zip>
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
FYI, the problem should (in theory) be fixed in r2741. Laurent On Oct 6, 2009, at 1:28 PM, Laurent Sansonetti wrote:
Hi Michael,
It's actually a well-known bug. MacRuby trunk doesn't honor the sel_of_type BridgeSupport attribute, therefore your sheet callback is registered to the runtime with the default signature (where all arguments and return value are Objective-C objects), and later it fails to convert the returnCode argument (in this backtrace, 0x1) as an Objective-C object.
Laurent
On Oct 6, 2009, at 12:58 PM, Michael Winterstein wrote:
I seem to have run into nearly the same problem that I had a while back, in this ticket: http://www.macruby.org/trac/ticket/221
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/ MacRuby/trunk/include/ruby/ruby.h:1252 #1 0x0000000100130161 in rb_vm_ocval_to_rval (ocval=0x1) at compiler.cpp:6155 #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. <Testfiles.zip>
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
It seems to be working in 2761, thanks. For a little while none of those calls were getting through (apparently being sent to drb.method_missing) so I couldn't check if it was working. 'RunModal' is a workaround for that specific call, too. I'm also looking into SL's new way of using sheets, with a completion handler. Michael On Oct 6, 2009, at 4:57 PM, Laurent Sansonetti wrote:
FYI, the problem should (in theory) be fixed in r2741.
Laurent
On Oct 6, 2009, at 1:28 PM, Laurent Sansonetti wrote:
Hi Michael,
It's actually a well-known bug. MacRuby trunk doesn't honor the sel_of_type BridgeSupport attribute, therefore your sheet callback is registered to the runtime with the default signature (where all arguments and return value are Objective-C objects), and later it fails to convert the returnCode argument (in this backtrace, 0x1) as an Objective-C object.
Laurent
On Oct 6, 2009, at 12:58 PM, Michael Winterstein wrote:
I seem to have run into nearly the same problem that I had a while back, in this ticket: http://www.macruby.org/trac/ticket/221
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/ MacRuby/trunk/include/ruby/ruby.h:1252 #1 0x0000000100130161 in rb_vm_ocval_to_rval (ocval=0x1) at compiler.cpp:6155 #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. <Testfiles.zip>
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Hiya :) I've a problem using Drb and get a problem I don't get if I use bog standard ruby 1.8 My client and server code is below. The server works fine but if I try and invoke any method on the client from the server I get this error: core:in `open:': can't convert NSMutableDictionary into String (TypeError) from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/ 1.9.0/drb/drb.rb:1196:in `initialize:' from core:in `__new__:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/ 1.9.0/drb/drb.rb:1163:in `open:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/ 1.9.0/drb/drb.rb:1109:in `with_friend:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/ 1.9.0/drb/drb.rb:1091:in `method_missing:' from /Users/garyliddon/drbtest.rb:1:in `<main>' Any help super gratefully received :) gaz SERVER CODE require 'drb' class Incrementer def initialize @value = 0 end def increment @value += 1 end end service = DRb.start_service("druby://localhost:4242", Incrementer.new) print "service started on port 4242\n" DRb.thread.join CLIENT CODE require 'drb' DRb.start_service server = DRbObject.new_with_uri('druby://localhost:4242') p server.increment #this is what causes the error
Could you please file a bug report? I'll try to look into it ASAP. Thanks, - Matt On Sun, Nov 1, 2009 at 9:42 AM, Gaz Liddon <gaz@gazaxian.com> wrote:
Hiya :)
I've a problem using Drb and get a problem I don't get if I use bog standard ruby 1.8
My client and server code is below.
The server works fine but if I try and invoke any method on the client from the server I get this error:
core:in `open:': can't convert NSMutableDictionary into String (TypeError) from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/1.9.0/drb/drb.rb:1196:in `initialize:' from core:in `__new__:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/1.9.0/drb/drb.rb:1163:in `open:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/1.9.0/drb/drb.rb:1109:in `with_friend:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/1.9.0/drb/drb.rb:1091:in `method_missing:' from /Users/garyliddon/drbtest.rb:1:in `<main>'
Any help super gratefully received :)
gaz
*SERVER CODE* require 'drb'
class Incrementer
def initialize @value = 0 end
def increment @value += 1 end
end
service = DRb.start_service("druby://localhost:4242", Incrementer.new) print "service started on port 4242\n" DRb.thread.join
* * *CLIENT CODE* require 'drb' DRb.start_service server = DRbObject.new_with_uri('druby://localhost:4242') p server.increment #this is what causes the error
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
participants (4)
-
Gaz Liddon
-
Laurent Sansonetti
-
Matt Aimonetti
-
Michael Winterstein