Index: GType.xs =================================================================== --- GType.xs (revision 1055) +++ GType.xs (working copy) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2005 by the gtk2-perl team (see the file AUTHORS for + * Copyright (C) 2003-2005, 2009 by the gtk2-perl team (see the file AUTHORS for * the full list) * * This library is free software; you can redistribute it and/or modify it @@ -254,10 +254,12 @@ GPerlValueWrapperClass * gperl_fundamental_wrapper_class_from_type (GType gtype) { - GPerlValueWrapperClass * res; + GPerlValueWrapperClass * res = NULL; G_LOCK (wrapper_class_by_type); - res = (GPerlValueWrapperClass *) - g_hash_table_lookup (wrapper_class_by_type, (gpointer) gtype); + if (wrapper_class_by_type) { + res = (GPerlValueWrapperClass *) + g_hash_table_lookup (wrapper_class_by_type, (gpointer) gtype); + } G_UNLOCK (wrapper_class_by_type); return res; } @@ -992,7 +994,12 @@ gperl_run_exception_handlers (); } else if (return_value) { - gperl_value_from_sv (return_value, POPs); + /* Same as gperl_closure_marshal() ... */ + /* we need to remove the value to from the stack, + * regardless of whether we do anything with it. */ + SV * sv = POPs; + if (G_VALUE_TYPE (return_value)) + gperl_value_from_sv (return_value, sv); PUTBACK; } SvSetSV (ERRSV, save_errsv);