[libpeas] Prioritize the initial GType when using peas_extension_call*()



commit d17d295a885c6837e869936a6bea362147d70ea2
Author: Garrett Regier <garrettregier gmail com>
Date:   Sat Apr 7 06:49:08 2012 -0700

    Prioritize the initial GType when using peas_extension_call*()
    
    Otherwise the incorrect interface could be called if they
    have the same method name.

 libpeas/peas-extension.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/libpeas/peas-extension.c b/libpeas/peas-extension.c
index 7c604f2..31e12b0 100644
--- a/libpeas/peas-extension.c
+++ b/libpeas/peas-extension.c
@@ -73,10 +73,23 @@ get_method_info (PeasExtension *exten,
                  GType         *interface)
 {
   guint i;
+  GType exten_type;
   GType *interfaces;
-  GICallableInfo *method_info = NULL;
+  GICallableInfo *method_info;
   gboolean must_free_interfaces = FALSE;
 
+  /* Must prioritize the initial GType */
+  exten_type = peas_extension_get_extension_type (exten);
+  method_info = peas_gi_get_method_info (exten_type, method_name);
+
+  if (method_info != NULL)
+    {
+      if (interface != NULL)
+        *interface = exten_type;
+
+      return method_info;
+    }
+
   if (PEAS_IS_EXTENSION_WRAPPER (exten))
     {
       interfaces = PEAS_EXTENSION_WRAPPER (exten)->interfaces;



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