[libpeas] python: fix use of PeasExtension with GInitiallyUnowned



commit cb413ab8680a2641c03cfbec7ec60fe603766cd4
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 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().
    */


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