I wrote:
> I've also encountered anomolous behaviour when attempting to 
> destroy an instance subclassed from gobject.  I receive errors 
> of the form:
>
> GLib-GObject-CRITICAL **: file gobject.c: line 1579 (g_object_unref):
> assertion `G_IS_OBJECT (object)' failed
>
> Also, it *sometimes* signals a SEGV.  

It seems that http://bugzilla.gnome.org/show_bug.cgi?id=122569 and the
above are one and the same.  I can confirm that the patch 
http://bugzilla.gnome.org/attachment.cgi?id=26172&action=view appears to
have fixed my problem as well.

I'm also attaching the diff I promised that allows one to specify
gtk.TYPE_NONE as the third element of __gsignals__ tuple.  If there is
something I need to do to make it better, please let me know.

Thanks.

--- gobjectmodule.c.20040409	2004-04-09 21:55:02.000000000 -0500
+++ gobjectmodule.c	2004-04-18 09:42:08.000000000 -0500
@@ -769,26 +769,31 @@
     if (!return_type)
 	return FALSE;
     if (!PySequence_Check(py_param_types)) {
-	gchar buf[128];
-
-	g_snprintf(buf, sizeof(buf), "third element of __gsignals__['%s'] tuple must be a sequence", signal_name);
-	PyErr_SetString(PyExc_TypeError, buf);
-	return FALSE;
-    }
-    n_params = PySequence_Length(py_param_types);
-    param_types = g_new(GType, n_params);
-    for (i = 0; i < n_params; i++) {
-	PyObject *item = PySequence_GetItem(py_param_types, i);
+	if (pyg_type_from_object(py_param_types) == pyg_type_from_object(Py_None)) {
+	    n_params = 0;
+	    param_types = NULL;
+	} else {
+	    gchar buf[128];
 
-	param_types[i] = pyg_type_from_object(item);
-	if (param_types[i] == 0) {
-	    Py_DECREF(item);
-	    g_free(param_types);
+	    g_snprintf(buf, sizeof(buf), "third element of __gsignals__['%s'] tuple must be a sequence", signal_name);
+	    PyErr_SetString(PyExc_TypeError, buf);
 	    return FALSE;
 	}
-	Py_DECREF(item);
+    } else {
+	n_params = PySequence_Length(py_param_types);
+	param_types = g_new(GType, n_params);
+	for (i = 0; i < n_params; i++) {
+	    PyObject *item = PySequence_GetItem(py_param_types, i);
+
+	    param_types[i] = pyg_type_from_object(item);
+	    if (param_types[i] == 0) {
+		Py_DECREF(item);
+		g_free(param_types);
+		return FALSE;
+	    }
+	    Py_DECREF(item);
+	}
     }
-
     signal_id = g_signal_newv(signal_name, instance_type, signal_flags,
 			      pyg_signal_class_closure_get(),
 			      (GSignalAccumulator)0, NULL,
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to