Skip to content

missing throw statements on ffi callback#4661

Closed
kares wants to merge 2 commits intojruby:masterfrom
kares:test-native-ffi-callback-raise
Closed

missing throw statements on ffi callback#4661
kares wants to merge 2 commits intojruby:masterfrom
kares:test-native-ffi-callback-raise

Conversation

@kares
Copy link
Member

@kares kares commented Jun 9, 2017

not sure about this one spec:ffi fails when the error is actually thrown

someone more familiar with the piece should look at it ...

HEREs the failed job: https://travis-ci.org/kares/jruby/jobs/241153466

@headius
Copy link
Member

headius commented Jun 9, 2017

Reproduced locally. I suspect there's some logic for unwrapping the Mapped type that did not get into our FFI.

@headius
Copy link
Member

headius commented Jun 9, 2017

This fixes it for me. Similar code seems to be in other type-wrangling logic.

diff --git a/core/src/main/java/org/jruby/ext/ffi/CallbackInfo.java b/core/src/main/java/org/jruby/ext/ffi/CallbackInfo.java
index 34d68a3cf4..79799dd89d 100644
--- a/core/src/main/java/org/jruby/ext/ffi/CallbackInfo.java
+++ b/core/src/main/java/org/jruby/ext/ffi/CallbackInfo.java
@@ -110,6 +110,10 @@ public class CallbackInfo extends Type {
                     + returnType.getMetaClass().getName() + " (expected FFI::Type)");
         }
 
+        if (returnType instanceof MappedType) {
+            returnType = ((MappedType) returnType).getRealType();
+        }
+
         if (!(paramTypes instanceof RubyArray)) {
             throw context.runtime.newTypeError("wrong argument type "
                     + paramTypes.getMetaClass().getName() + " (expected Array)");

@kares kares changed the title adding a missing throw statements on ffi callback fails spec missing throw statements on ffi callback Jun 10, 2017
@kares kares added this to the JRuby 9.1.11.0 milestone Jun 10, 2017
@kares
Copy link
Member Author

kares commented Jun 10, 2017

now on master (6d924dc), thanks

@kares kares closed this Jun 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants