[perl-Glib-Object-Introspection] Error out if asked to create boxed struct of unknown size
- From: Torsten SchÃnfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Glib-Object-Introspection] Error out if asked to create boxed struct of unknown size
- Date: Tue, 29 Jan 2013 23:29:47 +0000 (UTC)
commit 6138c1983cf78563f97a0db8b04ba58ce9438574
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date: Wed Jan 30 00:29:39 2013 +0100
Error out if asked to create boxed struct of unknown size
GObjectIntrospection.xs | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/GObjectIntrospection.xs b/GObjectIntrospection.xs
index df7aa1a..dcd9555 100644
--- a/GObjectIntrospection.xs
+++ b/GObjectIntrospection.xs
@@ -538,17 +538,22 @@ _construct_boxed (class, package)
CODE:
gtype = gperl_boxed_type_from_package (package);
if (!gtype)
- croak ("Could not find GType for package %s", package);
+ ccroak ("Could not find GType for package %s", package);
repository = g_irepository_get_default ();
info = g_irepository_find_by_gtype (repository, gtype);
if (!info) {
g_base_info_unref (info);
- croak ("Could not fetch information for package %s; "
- "perhaps it has not been loaded via "
- "Glib::Object::Introspection?",
- package);
+ ccroak ("Could not fetch information for package %s; "
+ "perhaps it has not been loaded via "
+ "Glib::Object::Introspection?",
+ package);
}
size = g_struct_info_get_size (info);
+ if (!size) {
+ g_base_info_unref (info);
+ ccroak ("Cannot create boxed struct of unknown size for package %s",
+ package);
+ }
/* We allocate memory for the boxed type here with malloc(), but then
* take a copy of it and discard the original so that the memory we
* hand out is always allocated with the allocator used for the boxed
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]