mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
Bug 556048 – Crash in g_irepository_find_by_gtype
* girepository/gtypelib.h (BLOB_IS_REGISTERED_TYPE): added * girepository/girepository.c (find_interface): Fix find_by_gtype case to get the type name from right offset svn path=/trunk/; revision=686
This commit is contained in:
parent
44172e786a
commit
6a82099f9b
@ -489,12 +489,17 @@ find_interface (gpointer key,
|
||||
{
|
||||
for (i = 1; i <= n_entries; i++)
|
||||
{
|
||||
RegisteredTypeBlob *blob;
|
||||
|
||||
entry = g_typelib_get_dir_entry (typelib, i);
|
||||
if (entry->blob_type < BLOB_TYPE_BOXED)
|
||||
if (!BLOB_IS_REGISTERED_TYPE (entry))
|
||||
continue;
|
||||
|
||||
offset = *(guint32*)&typelib->data[entry->offset + 8];
|
||||
type = g_typelib_get_string (typelib, offset);
|
||||
|
||||
blob = (RegisteredTypeBlob *)entry;
|
||||
if (!blob->gtype_name)
|
||||
continue;
|
||||
|
||||
type = g_typelib_get_string (typelib, blob->gtype_name);
|
||||
if (strcmp (type, iface_data->type) == 0)
|
||||
{
|
||||
index = i;
|
||||
|
@ -45,6 +45,13 @@ enum
|
||||
BLOB_TYPE_UNION
|
||||
};
|
||||
|
||||
#define BLOB_IS_REGISTERED_TYPE(blob) \
|
||||
((blob)->blob_type == BLOB_TYPE_STRUCT || \
|
||||
(blob)->blob_type == BLOB_TYPE_UNION || \
|
||||
(blob)->blob_type == BLOB_TYPE_ENUM || \
|
||||
(blob)->blob_type == BLOB_TYPE_OBJECT || \
|
||||
(blob)->blob_type == BLOB_TYPE_INTERFACE)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar magic[16];
|
||||
|
Loading…
Reference in New Issue
Block a user