[libpeas/proxys] [Python] Fix crash when python can't be initialized properly.



commit 88c4123842805e400fedaf950bd38758ae2ce2b0
Author: Steve Frécinaux <code istique net>
Date:   Wed May 26 10:20:04 2010 +0200

    [Python] Fix crash when python can't be initialized properly.
    
    We were calling into PySys without checking first if python was
    initialized, which resulted in a crash.

 loaders/python/peas-plugin-loader-python.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 998628f..fb86ad8 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -343,6 +343,9 @@ peas_plugin_loader_python_add_module_path (PeasPluginLoaderPython *self,
   g_return_val_if_fail (PEAS_IS_PLUGIN_LOADER_PYTHON (self), FALSE);
   g_return_val_if_fail (module_path != NULL, FALSE);
 
+  if (!Py_IsInitialized ())
+    return FALSE;
+
   pathlist = PySys_GetObject ("path");
   pathstring = PyString_FromString (module_path);
 



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