[libpeas] Fix releasing the gil state in the Python loader
- From: Steve Frécinaux <sfre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Fix releasing the gil state in the Python loader
- Date: Mon, 7 Mar 2011 17:20:47 +0000 (UTC)
commit 6a3dcd627a57546522c6f4d1f8d9c8526869d7d4
Author: Garrett Regier <alias301 gmail com>
Date: Mon Mar 7 01:49:04 2011 -0800
Fix releasing the gil state in the Python loader
loaders/python/peas-plugin-loader-python.c | 24 ++++++++++--------------
1 files changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 571acfb..ffecc14 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -144,7 +144,7 @@ peas_plugin_loader_python_create_extension (PeasPluginLoader *loader,
PyObject *pyobject;
PyObject *pyplinfo;
PyGILState_STATE state;
- PeasExtension *exten;
+ PeasExtension *exten = NULL;
pyinfo = (PythonInfo *) g_hash_table_lookup (pyloader->priv->loaded_plugins, info);
@@ -153,29 +153,23 @@ peas_plugin_loader_python_create_extension (PeasPluginLoader *loader,
pytype = find_python_extension_type (info, exten_type, pyinfo->module);
if (pytype == NULL)
- {
- pyg_gil_state_release (state);
- return NULL;
- }
+ goto out;
the_type = pyg_type_from_object ((PyObject *) pytype);
if (the_type == G_TYPE_INVALID)
+ goto out;
+
+ if (!g_type_is_a (the_type, exten_type))
{
- pyg_gil_state_release (state);
- return NULL;
+ g_warn_if_fail (g_type_is_a (the_type, exten_type));
+ goto out;
}
- /* FIXME: we don't release the gil state here. */
- g_return_val_if_fail (g_type_is_a (the_type, exten_type), NULL);
-
object = g_object_newv (the_type, n_parameters, parameters);
if (!object)
- {
- pyg_gil_state_release (state);
- return NULL;
- }
+ goto out;
pyobject = pygobject_new (object);
g_object_unref (object);
@@ -188,6 +182,8 @@ peas_plugin_loader_python_create_extension (PeasPluginLoader *loader,
exten = peas_extension_python_new (exten_type, pyobject);
Py_DECREF (pyobject);
+out:
+
pyg_gil_state_release (state);
return exten;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]