diff options
| author | Johan Dahlin <johan@src.gnome.org> | 2004-08-03 14:11:46 +0000 |
|---|---|---|
| committer | Johan Dahlin <johan@src.gnome.org> | 2004-08-03 14:11:46 +0000 |
| commit | 90aaf720cefcaed82196ea275b3a513315877300 (patch) | |
| tree | 3097d16165d7b0d8268e768cab019a553f2214b6 /gobject/pygpointer.c | |
| parent | 3e41db376f6e40c2df01a1f83c2ecf10a5315084 (diff) | |
| download | pygobject-90aaf720cefcaed82196ea275b3a513315877300.tar.gz pygobject-90aaf720cefcaed82196ea275b3a513315877300.tar.xz pygobject-90aaf720cefcaed82196ea275b3a513315877300.zip | |
Clean up most functions here to have only one return path.
* gtk/pygtktreemodel.c: Clean up most functions here to have only
one return path.
* gobject/pygobject.c (pygobject_emit): Protect g_value_unset by
UNBLOCK/BLOCK_THREADS since it might call pygobject_free which
will result in a deadlock.
* gobject/gobjectmodule.c (pyg_thread_init): New function, move
thread initalization stuff in here.
* All over the place: Kill pyg_block/unblock_threads and use
PyGILState and Py_BEGIN/END_ALLOW_THREADS.
unblock [code] block calls are replaced by Py_BEGIN/END and
block [code] unblock calls are replaced by PyGILState.
Diffstat (limited to 'gobject/pygpointer.c')
| -rw-r--r-- | gobject/pygpointer.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gobject/pygpointer.c b/gobject/pygpointer.c index b7e3cfc..4173e7c 100644 --- a/gobject/pygpointer.c +++ b/gobject/pygpointer.c @@ -185,16 +185,16 @@ pyg_register_pointer(PyObject *dict, const gchar *class_name, PyObject * pyg_pointer_new(GType pointer_type, gpointer pointer) { + PyGILState_STATE state; PyGPointer *self; PyTypeObject *tp; - g_return_val_if_fail(pointer_type != 0, NULL); - pyg_block_threads(); + state = PyGILState_Ensure(); if (!pointer) { Py_INCREF(Py_None); - pyg_unblock_threads(); + PyGILState_Release(state); return Py_None; } @@ -203,7 +203,7 @@ pyg_pointer_new(GType pointer_type, gpointer pointer) tp = (PyTypeObject *)&PyGPointer_Type; /* fallback */ self = PyObject_NEW(PyGPointer, tp); - pyg_unblock_threads(); + PyGILState_Release(state); if (self == NULL) return NULL; |
