[libpeas] Warn and fail when registering an extension impl multiple times



commit 165abc77e05a81b40f6fe6cb2ad7f0cad9e0fade
Author: Garrett Regier <garrettregier gmail com>
Date:   Wed Sep 10 01:59:42 2014 -0700

    Warn and fail when registering an extension impl multiple times
    
    Registering an extension impl multiple times will not have the
    desired effect as only the first one registered will ever be used.

 libpeas/peas-object-module.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/libpeas/peas-object-module.c b/libpeas/peas-object-module.c
index 474a173..88481b7 100644
--- a/libpeas/peas-object-module.c
+++ b/libpeas/peas-object-module.c
@@ -491,6 +491,7 @@ peas_object_module_register_extension_factory (PeasObjectModule *module,
   InterfaceImplementation impl = { iface_type, factory_func, user_data, destroy_func };
 
   g_return_if_fail (PEAS_IS_OBJECT_MODULE (module));
+  g_return_if_fail (!peas_object_module_provides_object (module, iface_type));
   g_return_if_fail (factory_func != NULL);
 
   if (iface_type != PEAS_TYPE_PLUGIN_LOADER)
@@ -545,6 +546,7 @@ peas_object_module_register_extension_type (PeasObjectModule *module,
                                             GType             extension_type)
 {
   g_return_if_fail (PEAS_IS_OBJECT_MODULE (module));
+  g_return_if_fail (!peas_object_module_provides_object (module, iface_type));
 
   if (iface_type != PEAS_TYPE_PLUGIN_LOADER)
     {


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