diff options
author | Steve Frécinaux <code@istique.net> | 2011-02-22 13:56:45 +0100 |
---|---|---|
committer | Steve Frécinaux <code@istique.net> | 2011-02-22 13:56:45 +0100 |
commit | 92b255f9b76a8bed118d1901105e6a87e7014b9f (patch) | |
tree | 581939d56eda69806e204919f5fecab2f13af691 | |
parent | f546844c03dc9f05c234c36638e2ccf3e4a645d3 (diff) | |
download | libpeas-0.7.3.tar.gz |
python: Rework refcounting to explicit extension ownership0.7.3
Previously the python reference was transferred to the Python extension
object. It is more correct to increment the refcount in the extension
and decrement it in the loader, because it's more explicit and won't
break in bizarre way if we create more than one Python extension wrapper
around the same object.
-rw-r--r-- | loaders/python/peas-extension-python.c | 1 | ||||
-rw-r--r-- | loaders/python/peas-plugin-loader-python.c | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/loaders/python/peas-extension-python.c b/loaders/python/peas-extension-python.c index 630b358..daa0097 100644 --- a/loaders/python/peas-extension-python.c +++ b/loaders/python/peas-extension-python.c @@ -95,6 +95,7 @@ peas_extension_python_new (GType gtype, "extension-type", gtype, NULL)); pyexten->instance = instance; + Py_INCREF (instance); return PEAS_EXTENSION (pyexten); } diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c index 1cbdf28..f52c27f 100644 --- a/loaders/python/peas-plugin-loader-python.c +++ b/loaders/python/peas-plugin-loader-python.c @@ -219,6 +219,8 @@ peas_plugin_loader_python_create_extension (PeasPluginLoader *loader, Py_DECREF (pyplinfo); exten = peas_extension_python_new (exten_type, pyobject); + Py_DECREF (pyobject); + pyg_gil_state_release (state); return exten; |