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 09:52:21 -0700
commitcb413ab8680a2641c03cfbec7ec60fe603766cd4 (patch)
treed07264916627da04e413b27541d7a8ca896eed25
parent3519643ca532ec1a3fc2409208302ddc546f169f (diff)
downloadlibpeas-cb413ab8680a2641c03cfbec7ec60fe603766cd4.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 6d7c582..26edbf3 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -123,6 +123,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().
*/