diff options
| author | Johan Dahlin <jdahlin@src.gnome.org> | 2004-06-04 11:29:46 +0000 |
|---|---|---|
| committer | Johan Dahlin <jdahlin@src.gnome.org> | 2004-06-04 11:29:46 +0000 |
| commit | 64c298cb4a8ba1be1bc5da6d7c3d6fa4398a6e7c (patch) | |
| tree | 2baa90f0455259817bf7d285ebdf4d8d6c4b623f /gobject/pygobject.c | |
| parent | e8c44c1626caed03d26c3657faae54c2573fb88c (diff) | |
Add a new example of subclassing a GtkWidget.
* examples/gtk/widget.py: Add a new example of subclassing a GtkWidget.
* Makefile.am (EXTRA_DIST): Add widget.py
* pygobject.c (pygobject_new): guard object_ref call
Diffstat (limited to 'gobject/pygobject.c')
| -rw-r--r-- | gobject/pygobject.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gobject/pygobject.c b/gobject/pygobject.c index 7e278b3..fa8ef90 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -254,6 +254,13 @@ pygobject_new_with_interfaces(GType gtype) PyErr_Print(); return NULL; } + +#if 0 + type->tp_dealloc = (destructor)pygobject_dealloc; + type->tp_traverse = (traverseproc)pygobject_traverse; + type->tp_clear = (inquiry)pygobject_clear; + type->tp_flags |= Py_TPFLAGS_HAVE_GC; +#endif if (PyType_Ready(type) < 0) { g_warning ("couldn't make the type `%s' ready", type->tp_name); @@ -344,12 +351,12 @@ pygobject_new(GObject *obj) pygobject_new_with_interfaces(). fixes bug #141042 */ if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE) Py_INCREF(tp); - self = PyObject_GC_New(PyGObject, tp); - if (self == NULL) return NULL; + pyg_unblock_threads(); self->obj = g_object_ref(obj); + pyg_block_threads(); sink_object(self->obj); self->inst_dict = NULL; |
