[libpeas] If calling the wrapper function fails set the return value to NULL
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] If calling the wrapper function fails set the return value to NULL
- Date: Thu, 29 Mar 2012 01:08:08 +0000 (UTC)
commit 6948aa2a9ca409a1ee968ee7e64cc56845df8e55
Author: Garrett Regier <garrettregier gmail com>
Date: Wed Mar 21 17:44:49 2012 -0700
If calling the wrapper function fails set the return value to NULL
This way for gjs, python and seed plugins if an error occurs while
calling the function a pointer value would be set to NULL which
should help prevent segfaults.
libpeas/peas-extension-subclasses.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/libpeas/peas-extension-subclasses.c b/libpeas/peas-extension-subclasses.c
index ffb7289..b110f98 100644
--- a/libpeas/peas-extension-subclasses.c
+++ b/libpeas/peas-extension-subclasses.c
@@ -64,6 +64,7 @@ handle_method_impl (ffi_cif *cif,
PeasExtensionWrapper *instance;
GIArgument *arguments;
GIArgument return_value;
+ gboolean success;
instance = *((PeasExtensionWrapper **) args[0]);
g_assert (PEAS_IS_EXTENSION_WRAPPER (instance));
@@ -83,9 +84,12 @@ handle_method_impl (ffi_cif *cif,
arguments[i].v_pointer = *((gpointer **) args[i + 1]);
}
- peas_extension_wrapper_callv (instance, impl->interface_type,
- impl->invoker_info, impl->method_name,
- arguments, &return_value);
+ success = peas_extension_wrapper_callv (instance, impl->interface_type,
+ impl->invoker_info, impl->method_name,
+ arguments, &return_value);
+
+ if (!success)
+ memset (&return_value, 0, sizeof (GIArgument));
g_callable_info_load_return_type (impl->invoker_info, &return_type_info);
if (g_type_info_get_tag (&return_type_info) != GI_TYPE_TAG_VOID)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]