jhass / crystal-gobject

gobject-introspection for Crystal
BSD 3-Clause "New" or "Revised" License
127 stars 13 forks source link

Invalid memory access when using Apache Arrow GObject bindings #94

Closed christopherzimmerman closed 2 years ago

christopherzimmerman commented 2 years ago

I've been using the library to bind to Apache Arrow, and 99% of methods are working fine, except for initializing objects that take a GLib::List in any of their constructors.

Minimal example

require "gobject"
require_gobject "Arrow"

Arrow::Schema.new
Invalid memory access (signal 11) at address 0x0
[0x10f388e9b] *Exception::CallStack::print_backtrace:Nil +107
[0x10f3731b0] ~procProc(Int32, Pointer(LibC::SiginfoT), Pointer(Void), Nil)@/usr/local/Cellar/crystal/1.2.1/src/signal.cr:127 +304
[0x7fff203ccd7d] _sigtramp +29
[0x10f523e42] _ZL26garrow_schema_set_propertyP8_GObjectjPK7_GValueP11_GParamSpec +114
[0x10f636125] object_set_property +325
[0x10f63581d] g_object_new_internal +445
[0x10f634f63] g_object_new_with_properties +435
[0x10f3eb8ec] *Arrow::Schema#initialize:Pointer(Void) +76
[0x10f3eb87c] *Arrow::Schema::new:Arrow::Schema +92
[0x10f35ba3f] __crystal_main +1103
[0x10f3eccb9] *Crystal::main_user_code<Int32, Pointer(Pointer(UInt8))>:Nil +9
[0x10f3ecb4b] *Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32 +43
[0x10f367829] main +9

This is the method being called. I'm not that familiar with the underlying GObject implementation, but in the Ruby equivalent, Arrow::Schema accepts an array of Arrow::Fields, so I am wondering if the constructor generation is somehow off.

If it helps, here are the constructors generated for Arrow::Schema

image

christopherzimmerman commented 2 years ago

Closing as the main issue seems to be elsewhere, opening a more relevant issue that should be easier to troubleshoot.