[libpeas] Move the module support check to constructor



commit 2c3f820909dc0ac9474a980ae8aebf99ac557405
Author: Garrett Regier <alias301 gmail com>
Date:   Sun Feb 6 03:32:19 2011 -0800

    Move the module support check to constructor
    
    Otherwise using libpeas API would cause a
    segfault if modules were not supported.

 libpeas/peas-engine.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c
index 1c6257d..3fe9e5e 100644
--- a/libpeas/peas-engine.c
+++ b/libpeas/peas-engine.c
@@ -295,12 +295,6 @@ add_loader (PeasEngine       *engine,
 static void
 peas_engine_init (PeasEngine *engine)
 {
-  if (!g_module_supported ())
-    {
-      g_warning ("libpeas is not able to initialize the plugins engine.");
-      return;
-    }
-
   engine->priv = G_TYPE_INSTANCE_GET_PRIVATE (engine,
                                               PEAS_TYPE_ENGINE,
                                               PeasEnginePrivate);
@@ -346,6 +340,14 @@ peas_engine_constructor (GType                  type,
 {
   GObject *object;
 
+  /* We don't support calling PeasEngine API without module support */
+  if (!g_module_supported ())
+    {
+      g_warning ("libpeas is not able to create the "
+                 "plugins engine as modules are not supported.");
+      return NULL;
+    }
+
   if (default_engine != NULL)
     return g_object_ref (G_OBJECT (default_engine));
 



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