mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-01 21:33:09 +02: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++)
|
for (i = 1; i <= n_entries; i++)
|
||||||
{
|
{
|
||||||
|
RegisteredTypeBlob *blob;
|
||||||
|
|
||||||
entry = g_typelib_get_dir_entry (typelib, i);
|
entry = g_typelib_get_dir_entry (typelib, i);
|
||||||
if (entry->blob_type < BLOB_TYPE_BOXED)
|
if (!BLOB_IS_REGISTERED_TYPE (entry))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
offset = *(guint32*)&typelib->data[entry->offset + 8];
|
blob = (RegisteredTypeBlob *)entry;
|
||||||
type = g_typelib_get_string (typelib, offset);
|
if (!blob->gtype_name)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
type = g_typelib_get_string (typelib, blob->gtype_name);
|
||||||
if (strcmp (type, iface_data->type) == 0)
|
if (strcmp (type, iface_data->type) == 0)
|
||||||
{
|
{
|
||||||
index = i;
|
index = i;
|
||||||
|
@ -45,6 +45,13 @@ enum
|
|||||||
BLOB_TYPE_UNION
|
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
|
typedef struct
|
||||||
{
|
{
|
||||||
gchar magic[16];
|
gchar magic[16];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user