Ferada/cl-cffi-gtk

Unboxed G-Error?

jmercouris opened this issue · 6 comments

The following code:

  (gobject:g-signal-connect
   (gtk-object buffer) "load-failed"
   (lambda (web-view load-event failing-uri error)
     (declare (ignore load-event failing-uri web-view error))
     (print "Load Fail")))

Produces an error:

Unknown GBoxed type 'GError'
   [Condition of type SIMPLE-ERROR]

Restarts:
 0: [ABORT] Exit debugger, returning to top level.

Backtrace:
  0: (GOBJECT::GET-G-BOXED-FOREIGN-INFO-FOR-GTYPE #<GTYPE :name "GError" :id 140228195051424>)
  1: ((:METHOD GOBJECT::PARSE-G-VALUE-FOR-TYPE (T (EQL (GOBJECT:GTYPE "GBoxed")))) #.(SB-SYS:INT-SAP #X01F38E68) #<unused argument>) [fast-method]
  2: ((FLET CALL-NEXT-METHOD :IN "/Users/jmercouris/.quicklisp/dists/quicklisp/software/cl-cffi-gtk-20200427-git/gobject/gobject.g-value.lisp"))
  3: ((:METHOD GOBJECT::PARSE-G-VALUE-FOR-TYPE :AROUND (T T)) #.(SB-SYS:INT-SAP #X01F38E68) #<GTYPE :name "GBoxed" :id 72>) [fast-method]
  4: ((SB-PCL::GF-DISPATCH GOBJECT::PARSE-G-VALUE-FOR-TYPE) #.(SB-SYS:INT-SAP #X01F38E68) #<GTYPE :name "GBoxed" :id 72>)
  5: ((:METHOD GOBJECT::PARSE-G-VALUE-FOR-TYPE (T T)) #.(SB-SYS:INT-SAP #X01F38E68) #<GTYPE :name "GError" :id 140228195051424>) [fast-method]
  6: ((FLET CALL-NEXT-METHOD :IN "/Users/jmercouris/.quicklisp/dists/quicklisp/software/cl-cffi-gtk-20200427-git/gobject/gobject.g-value.lisp"))
  7: ((:METHOD GOBJECT::PARSE-G-VALUE-FOR-TYPE :AROUND (T T)) #.(SB-SYS:INT-SAP #X01F38E68) #<GTYPE :name "GError" :id 140228195051424>) [fast-method]
  8: ((SB-PCL::GF-DISPATCH GOBJECT::PARSE-G-VALUE-FOR-TYPE) #.(SB-SYS:INT-SAP #X01F38E68) #<GTYPE :name "GError" :id 140228195051424>)
  9: (GOBJECT:PARSE-G-VALUE #.(SB-SYS:INT-SAP #X01F38E68))
 10: (GOBJECT::PARSE-CLOSURE-ARGUMENTS 4 #.(SB-SYS:INT-SAP #X01F38E20))
 11: ((LAMBDA (GOBJECT::CLOSURE GOBJECT::RETURN-VALUE GOBJECT::COUNT-OF-ARGS GOBJECT::ARGS GOBJECT::INVOCATION-HINT GOBJECT::MARSHAL-DATA) :IN "/Users/jmercouris/.quicklisp/dists/quicklisp/software/cl-cffi..
 12: ((LAMBDA (SB-ALIEN::ARGS-POINTER SB-ALIEN::RESULT-POINTER FUNCTION) :IN "/Users/jmercouris/.quicklisp/dists/quicklisp/software/cl-cffi-gtk-20200427-git/gobject/gobject.signals.lisp") #<unavailable arg..
 13: ("foreign function: funcall_alien_callback")
 14: ("foreign function: #x2010073B")
 15: ("foreign function: #x1CB7E00")
 16: ("foreign function: signal_emit_unlocked_R")
 17: ("foreign function: g_signal_emit_valist")
 18: ("foreign function: g_signal_emit")
 19: ("foreign function: _Z23webkitWebViewLoadFailedP14_WebKitWebView15WebKitLoadEventPKcP7_GError")
 --more--

here is the relevant section of the API:
https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#WebKitWebView-load-failed

In the Crategus repository, this problem has been fixed as of commit: b658905

Any ideas?

I think it was worked around by 37ec76e. Of course with that definition you won't be able to decode the error object.

Maybe try this here #43 and see if that works for you? I've yet to add some testing and make it link up with the GLib-only definition for it though.

We will give it a try ASAP @Ambrevar

Thank you for the help so far!

I'm on it.

I get this error:

The function GLIB::MAKE-G-ERROR is undefined.
   [Condition of type UNDEFINED-FUNCTION]

Restarts:
 0: [CONTINUE] Retry calling GLIB::MAKE-G-ERROR.
 1: [USE-VALUE] Call specified function.
 2: [RETURN-VALUE] Return specified values.
 3: [RETURN-NOTHING] Return zero values.
 4: [ABORT] abort thread (#<THREAD "cl-cffi-gtk main thread" RUNNING {1008C89B03}>)

Backtrace:
 0: ("undefined function")
 1: ((:METHOD CFFI:TRANSLATE-FROM-FOREIGN (T GOBJECT::BOXED-CSTRUCT-FOREIGN-TYPE)) #.(SB-SYS:INT-SAP #X7F04C02FE320) #<GOBJECT::BOXED-CSTRUCT-FOREIGN-TYPE {10030DD2D3}>) [fast-method]
 2: (GOBJECT::PARSE-CLOSURE-ARGUMENTS 4 #.(SB-SYS:INT-SAP #X7F04CE235BA0))
 3: ((LAMBDA (GOBJECT::CLOSURE GOBJECT::RETURN-VALUE GOBJECT::COUNT-OF-ARGS GOBJECT::ARGS GOBJECT::INVOCATION-HINT GOBJECT::MARSHAL-DATA) :IN "/home/ambrevar/common-lisp/cl-cffi-gtk/gobject/gobject.signal..
 4: ((LAMBDA (SB-ALIEN::ARGS-POINTER SB-ALIEN::RESULT-POINTER FUNCTION) :IN "/home/ambrevar/common-lisp/cl-cffi-gtk/gobject/gobject.signals.lisp") #<unavailable argument> #<unavailable argument> #<unavail..
 5: ("foreign function: funcall_alien_callback")
 6: ("foreign function: callback_wrapper_trampoline")
 7: ("foreign function: #x5010073B")
 8: ((LAMBDA NIL :IN GTK:ENSURE-GTK-MAIN))
 9: ((LAMBDA NIL :IN BORDEAUX-THREADS::BINDING-DEFAULT-SPECIALS))
10: ((FLET SB-UNIX::BODY :IN SB-THREAD::NEW-LISP-THREAD-TRAMPOLINE))
11: ((FLET "WITHOUT-INTERRUPTS-BODY-4" :IN SB-THREAD::NEW-LISP-THREAD-TRAMPOLINE))
12: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::NEW-LISP-THREAD-TRAMPOLINE))
13: ((FLET "WITHOUT-INTERRUPTS-BODY-1" :IN SB-THREAD::CALL-WITH-MUTEX))
14: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::NEW-LISP-THREAD-TRAMPOLINE) {7F04CE236D8B}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD "cl-..
15: (SB-THREAD::NEW-LISP-THREAD-TRAMPOLINE #<SB-THREAD:THREAD "cl-cffi-gtk main thread" RUNNING {1008C89B03}> NIL #<CLOSURE (LAMBDA NIL :IN BORDEAUX-THREADS::BINDING-DEFAULT-SPECIALS) {1008C89AAB}> NIL)
16: ("foreign function: call_into_lisp")
17: ("foreign function: new_thread_trampoline")
 --more--

Any updates on this?