mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
girepository: Return pointer array for interface cache
In g_irepository_get_object_gtype_interfaces(), returning the address of the first GIBaseInfo* does not work reliably, because the GIBaseInfos are not necessarily stored contiguously. So the second and subsequent ones might be garbage. Instead, return the address of the array of GIBaseInfo pointers. Add a test that verifies the functionality, as well. This is unfortunately an API and ABI break.
This commit is contained in:
parent
1a19f05a0e
commit
a458c66cbf
@ -984,13 +984,13 @@ g_irepository_find_by_error_domain (GIRepository *repository,
|
||||
* returning a concrete class of #GLocalFile, which is a #GType we
|
||||
* see at runtime, but not statically.
|
||||
*
|
||||
* Since: 1.60
|
||||
* Since: 1.62
|
||||
*/
|
||||
void
|
||||
g_irepository_get_object_gtype_interfaces (GIRepository *repository,
|
||||
GType gtype,
|
||||
guint *n_interfaces_out,
|
||||
GIInterfaceInfo **interfaces_out)
|
||||
GIInterfaceInfo ***interfaces_out)
|
||||
{
|
||||
GTypeInterfaceCache *cache;
|
||||
|
||||
@ -1039,7 +1039,7 @@ g_irepository_get_object_gtype_interfaces (GIRepository *repository,
|
||||
}
|
||||
|
||||
*n_interfaces_out = cache->n_interfaces;
|
||||
*interfaces_out = *((GIInterfaceInfo**)&(cache->interfaces[0]));
|
||||
*interfaces_out = (GIInterfaceInfo**)&cache->interfaces[0];
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -163,7 +163,7 @@ GI_AVAILABLE_IN_1_60
|
||||
void g_irepository_get_object_gtype_interfaces (GIRepository *repository,
|
||||
GType gtype,
|
||||
guint *n_interfaces_out,
|
||||
GIInterfaceInfo **interfaces_out);
|
||||
GIInterfaceInfo ***interfaces_out);
|
||||
|
||||
GI_AVAILABLE_IN_ALL
|
||||
gint g_irepository_get_n_infos (GIRepository *repository,
|
||||
|
Loading…
Reference in New Issue
Block a user