Potential g-wrap bug?

Derek Atkins warlord@MIT.EDU
04 Jun 2002 11:24:46 -0400


With help from Bill Gribble I tracked down part of this problem.  If
I pass "#f" into a function expecting a gw:glist-of, it still produces
a segfault.  If I pass "'()" (an empty list) it works properly and does
not seg fault.

The incorrect type issue was my own fault for passing a symbol instead
of the symbol's value (thanks, Bill).

However, you still might want to look at the generated code for
parsing gw:glist-of.  My guess is that it's assuming the passed-in
function is a list instead of checking for null? first.

-derek

Derek Atkins <warlord@MIT.EDU> writes:

> (gw:wrap-function
>  ws
>  'gnc:query-set-sort-order
>  '<gw:void>
>  "xaccQuerySetSortOrder"
>  '((<gnc:Query*> q)
>    ((gw:glist-of <gnc:id-type> callee-owned) primary)
>    ((gw:glist-of <gnc:id-type> callee-owned) secondary)
>    ((gw:glist-of <gnc:id-type> callee-owned) tertiary))
>  "set sort order.")
>
[snip]
> 
> (gnc:query-set-sort-order query #f #f #f)
> 
> I get a SEGV in the g-wrap wrapper helper function:
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 1024 (LWP 18182)]
> gw__tmp404_xaccQuerySetSortOrder_wrapper (gw__scm_arg0=1088900432, 
>     gw__scm_arg1=8564, gw__scm_arg2=8564, gw__scm_arg3=8564)
>     at gw-engine.c:14254
> 14254       SCM gw__tmp565_scm_item = SCM_CAR(gw__tmp563_scm_rest);
> (gdb) where
> #0  gw__tmp404_xaccQuerySetSortOrder_wrapper (gw__scm_arg0=1088900432, 
>     gw__scm_arg1=8564, gw__scm_arg2=8564, gw__scm_arg3=8564)
>     at gw-engine.c:14254
> #1  0x40046537 in scm_gsubr_apply (args=1088887552) at gsubr.c:169

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available