[libpeas] Don't assume libpeas's stuff is initialized if python is.



commit 44aa2868197bf6ddfece03ae8e162c402deb1d75
Author: Steve Frécinaux <code istique net>
Date:   Sun Jun 27 19:56:33 2010 +0200

    Don't assume libpeas's stuff is initialized if python is.
    
    We need to ensure we run our own initialization function even if python
    has already been initialized by someone else (either our host
    application or something like gtkparasite).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=620060

 loaders/python/peas-plugin-loader-python.c |   16 ++--------------
 1 files changed, 2 insertions(+), 14 deletions(-)
---
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 7867f1c..b728e92 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -386,26 +386,14 @@ peas_python_init (PeasPluginLoaderPython *loader)
   char *argv[] = { "", NULL };
   gchar *prgname;
 
-  if (loader->priv->init_failed)
-    {
-      /* We already failed to initialized Python, don't need to
-       * retry again */
-      return FALSE;
-    }
-
-  if (Py_IsInitialized ())
-    {
-      /* Python has already been successfully initialized */
-      return TRUE;
-    }
-
   /* We are trying to initialize Python for the first time,
      set init_failed to FALSE only if the entire initialization process
      ends with success */
   loader->priv->init_failed = TRUE;
 
   /* Python initialization */
-  Py_InitializeEx (FALSE);
+  if (!Py_IsInitialized ())
+    Py_InitializeEx (FALSE);
 
   prgname = g_get_prgname ();
   if (prgname != NULL)



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