Permalink
Browse files

Prioritize the initial GType when using peas_extension_call*()

Otherwise the incorrect interface could be called if they
have the same method name.
  • Loading branch information...
1 parent 3fb1fea commit d17d295a885c6837e869936a6bea362147d70ea2 @gregier committed Apr 7, 2012
Showing with 14 additions and 1 deletion.
  1. +14 −1 libpeas/peas-extension.c
View
@@ -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;

0 comments on commit d17d295

Please sign in to comment.