perl-Glib r1107 - trunk
- From: tsch svn gnome org
- To: svn-commits-list gnome org
- Subject: perl-Glib r1107 - trunk
- Date: Sun, 8 Mar 2009 18:33:31 +0000 (UTC)
Author: tsch
Date: Sun Mar 8 18:33:31 2009
New Revision: 1107
URL: http://svn.gnome.org/viewvc/perl-Glib?rev=1107&view=rev
Log:
(gperl_callback_invoke): Fix a giant leak by properly unsetting all GValues
used for the callback arguments. Patch by Kevin Ryde.
Modified:
trunk/ChangeLog
trunk/GClosure.xs
Modified: trunk/GClosure.xs
==============================================================================
--- trunk/GClosure.xs (original)
+++ trunk/GClosure.xs Sun Mar 8 18:33:31 2009
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the full
- * list)
+ * Copyright (C) 2003-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
* under the terms of the GNU Library General Public License as published by
@@ -366,6 +366,16 @@
if (callback->n_params > 0) {
int i;
+ /* Crib note: must g_value_unset() even when asking for
+ * G_VALUE_NOCOPY_CONTENTS. A GObject is always
+ * g_object_ref()ed for storage in a GValue, even under
+ * G_VALUE_NOCOPY_CONTENTS (see code in
+ * g_value_object_collect_value()). Always reffing in
+ * G_VALUE_COLLECT is in fact the recommended behaviour for
+ * all ref-counted types (see the GTypeValueTable docs,
+ * apparently to ensure objects remain alive for the
+ * duration of a g_signal_emit_valist()).
+ */
for (i = 0 ; i < callback->n_params ; i++) {
gchar * error = NULL;
GValue v = {0, };
@@ -391,6 +401,7 @@
croak ("%s", SvPV_nolen (errstr));
}
sv = gperl_sv_from_value (&v);
+ g_value_unset (&v);
if (!sv) {
/* this should be very rare, too. */
PUTBACK;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]