[libpeas/1.24: 6/11] python: fix use of PeasExtension with GInitiallyUnowned



commit f8bcbb810d88942fc019c2686dd4a8bb2bc9b2cd
Author: Tom Schoonjans <Tom Schoonjans diamond ac uk>
Date:   Thu Oct 3 15:07:25 2019 +0100

    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.

 loaders/python/peas-plugin-loader-python.c | 4 ++++
 1 file changed, 4 insertions(+)
---
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().
    */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]