summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Schoonjans <Tom.Schoonjans@diamond.ac.uk>2019-10-03 15:07:25 +0100
committerChristian Hergert <chergert@redhat.com>2019-10-28 10:16:44 -0700
commitf8bcbb810d88942fc019c2686dd4a8bb2bc9b2cd (patch)
tree972f28377374e7a96778030e22d3589577517070
parent818f8d1ae976ff5a3695fa285c75bace593b412c (diff)
downloadlibpeas-f8bcbb810d88942fc019c2686dd4a8bb2bc9b2cd.tar.gz
python: fix use of PeasExtension with GInitiallyUnowned
This patch fixes a segfault which occurred whenever instantiating an object that derived from GInitiallyUnowned, such as GtkWidget.
-rw-r--r--loaders/python/peas-plugin-loader-python.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 9ac1a77..9b77f76 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -124,6 +124,10 @@ peas_plugin_loader_python_create_extension (PeasPluginLoader *loader,
if (object == NULL)
goto out;
+ /* Sink floating references if necessary */
+ if (g_object_is_floating (object))
+ g_object_ref_sink (object);
+
/* We have to remember which interface we are instantiating
* for the deprecated peas_extension_get_extension_type().
*/