From a4bc03d66d9fa9c42667cf2cfbb5ba50cb2a14e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20G=2E=20Aragoneses?= Date: Fri, 5 Sep 2008 07:38:11 +0000 Subject: [PATCH] =?UTF-8?q?2008-09-05=20=20Andr=C3=A9s=20G.=20Aragoneses?= =?UTF-8?q?=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes BNC#387220. * glib/glue/signal.c: New glue file to call g_signal_query(). * glib/glue/Makefile.am: Add signal.c. * glib/Signal.cs: check return type prior to emitting. svn path=/trunk/gtk-sharp/; revision=112360 --- ChangeLog | 7 +++++++ glib/Signal.cs | 21 +++++++++++++++------ glib/glue/Makefile.am | 1 + glib/glue/signal.c | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 glib/glue/signal.c diff --git a/ChangeLog b/ChangeLog index 2e31dfe50..666db3fd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-09-05 Andrés G. Aragoneses + + Fixes BNC#387220. + * glib/glue/signal.c: New glue file to call g_signal_query(). + * glib/glue/Makefile.am: Add signal.c. + * glib/Signal.cs: check return type prior to emitting. + 2008-08-28 Andrés G. Aragoneses * atk/Util.custom: unregister get_root function when the setter diff --git a/glib/Signal.cs b/glib/Signal.cs index 17a398b7b..d3e21cf45 100644 --- a/glib/Signal.cs +++ b/glib/Signal.cs @@ -311,15 +311,18 @@ namespace GLib { inst_and_params.Append (vals [i]); } - GLib.Value ret = GLib.Value.Empty; - - g_signal_emitv (inst_and_params.ArrayPtr, signal_id, gquark, ref ret); - object ret_obj = ret.Val; + object ret_obj = null; + if (glibsharp_signal_get_return_type (signal_id) != GType.None.Val) { + GLib.Value ret = GLib.Value.Empty; + g_signal_emitv (inst_and_params.ArrayPtr, signal_id, gquark, ref ret); + ret_obj = ret.Val; + ret.Dispose (); + } else + g_signal_emitv (inst_and_params.ArrayPtr, signal_id, gquark, IntPtr.Zero); foreach (GLib.Value val in vals) val.Dispose (); - ret.Dispose (); - + return ret_obj; } @@ -361,6 +364,12 @@ namespace GLib { [DllImport("libgobject-2.0-0.dll")] static extern void g_signal_emitv (IntPtr instance_and_params, uint signal_id, uint gquark_detail, ref GLib.Value return_value); + [DllImport("libgobject-2.0-0.dll")] + static extern void g_signal_emitv (IntPtr instance_and_params, uint signal_id, uint gquark_detail, IntPtr return_value); + + [DllImport("glibsharpglue-2")] + static extern IntPtr glibsharp_signal_get_return_type (uint signal_id); + [DllImport("libgobject-2.0-0.dll")] static extern uint g_signal_lookup (IntPtr name, IntPtr itype); diff --git a/glib/glue/Makefile.am b/glib/glue/Makefile.am index dd67778cc..3f34cc9e9 100644 --- a/glib/glue/Makefile.am +++ b/glib/glue/Makefile.am @@ -7,6 +7,7 @@ libglibsharpglue_2_la_SOURCES = \ error.c \ list.c \ object.c \ + signal.c \ slist.c \ type.c \ unichar.c \ diff --git a/glib/glue/signal.c b/glib/glue/signal.c new file mode 100644 index 000000000..24286e0fe --- /dev/null +++ b/glib/glue/signal.c @@ -0,0 +1,34 @@ +/* signal.c : Glue for signaling stuff + * + * Author: Andrés G. Aragoneses + * + * Copyright (c) 2008 Novell Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the Lesser GNU General + * Public License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +/* Forward declarations */ +GType glibsharp_signal_get_return_type (guint signal_id); +/* */ + +GType +glibsharp_signal_get_return_type (guint signal_id) +{ + GSignalQuery query; + g_signal_query (signal_id, &query); + return query.return_type; +}