[libpeas] Fix loading plugins with an invalid dependency



commit 4578a8417d32ba8ee30ed1d62e22af366e66c44f
Author: Garrett Regier <alias301 gmail com>
Date:   Thu Dec 9 09:32:59 2010 -0800

    Fix loading plugins with an invalid dependency
    
    Before the plugin would still be loaded and available.

 libpeas/peas-engine.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c
index 32670f6..d387522 100644
--- a/libpeas/peas-engine.c
+++ b/libpeas/peas-engine.c
@@ -748,11 +748,11 @@ load_plugin (PeasEngine     *engine,
       if (!dep_info)
         {
           g_warning ("Plugin not found: %s", dependencies[i]);
-          return FALSE;
+          goto error;
         }
 
       if (!peas_engine_load_plugin (engine, dep_info))
-        return FALSE;
+        goto error;
     }
 
   loader = get_plugin_loader (engine, info);
@@ -761,19 +761,23 @@ load_plugin (PeasEngine     *engine,
     {
       g_warning ("Could not find loader '%s' for plugin '%s'",
                  info->loader, info->name);
-      info->available = FALSE;
-      return FALSE;
+      goto error;
     }
 
   if (!peas_plugin_loader_load (loader, info))
     {
       g_warning ("Error loading plugin '%s'", info->name);
-      info->loaded = FALSE;
-      info->available = FALSE;
-      return FALSE;
+      goto error;
     }
 
   return TRUE;
+
+error:
+
+  info->loaded = FALSE;
+  info->available = FALSE;
+
+  return FALSE;
 }
 
 static void



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