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.
By doing so, we essentially cover the various compiler flags that we
want to use for non-Visual Studio builds to check for warnings that
might cause real concern.
This also skips the checks for the various GCC-isque CFlag checks that
are scattered in the various build files on Visual Studio builds, since
they are essentially meaningless on Visual Studio builds.
If g_mapped_file_new fails, then `version` will be freed, but it was
already added to the hash table. This means there could be a
use-after-free while doing a lookup on the hash table the next time.
If a transitive dependency appears twice, the original pointer will be
removed from the hash table. Since these names were created by
g_strsplit, they need to be freed, or they will leak.
Bindings in some cases need to look up information from a GType
dynamically. Support that better by supplying a cache for this
information.
(Rebased and versioning / gtk-doc stuff added by Philip Chimento.)
Closes#38.
See gjs#55.
This enables various compiler warnings project wide and disables the triggered
ones for each library/executable. This should give us roughly the same behaviour
as with autotools.
Tested with gcc8 and clang7.
This adds the following macros and functions: GI_MAJOR_VERSION, GI_MICRO_VERSION,
GI_MINOR_VERSION, GI_CHECK_VERSION, gi_get_major_version,gi_get_micro_version,
gi_get_minor_version.
Since we share a prefix with glib we have to namespace these by using the gi_
prefix. g_gi would also work but we already export symbols with gi_ like
gi_cclosure_marshal_generic(), gi_type_tag_get_ffi_type() and
gi_type_info_extract_ffi_return_value(), so let's not add another naming scheme.
GITypeInfo is a GIBaseInfo so calling g_base_info_get_name() on it should do something
sensible.
g_base_info_get_name() has always been documented to return NULL in case no name
is available so return that instead.
The gtk-doc docs were including some bits of overal g-i docs but mostly unfinished
and outdated.
We now have the general docs in sphinx so remove the duplication and make the gtk-docs
just about the libgirepository API and nothing more.
This also renames some titles and fixes some missing links in the struct hierarchy
while at it.
Move things around and rename things until gtk-doc is happy.
This also moves the "Since" annotations to the next stable releases and
adds version added info for g_callable_info_get_instance_ownership_transfer()
and g_struct_info_find_field().
Some documentation tool (as hotdoc[0]) need to have information about
symbol declaration and documentation positions in the source files
to be able to do smart indexing (automatically build the documenation
index).
[0] https://hotdoc.github.io/Fixes#175
In case the surrounding code handles missing cases break, otherwise add
a g_assert_not_reached().
The generated parser code triggers this as well, so disable it there only.
Where it's easy add dummy args to match the cast; where the target is a subset just
prevent the warning with a cast to void*.
Provide a real copy function for the boxed type code in regress_foo.
This code is never executed afaics, but why not.
On Windows (Visual Studio at least), unsigned longs are always 4 bytes,
on both 32-bit and x64 Windows, so we cannot use unsigned longs to deal
with pointers on 64-bit builds, as pointers are 8 bytes on 64-bit
Windows, which may well render the pointer (which we acquired from
libffi) invalid.
This will fix crashes in PyGObject which are manifested when launching
the cairo-demo example sript (intermittent) and when clicking on
"Interactive Dialog" button in the Dialog demo in the PyGObject GTK+
Code demos before entering anything in Entry 1 and Entry 2, when running
on x64 Visual Studio builds of the GTK+/PyGObject stack.
Also use size_t instead of unsigned long in gthash.c when we check that
memory & 0x3 is 0, to silence compiler warnings from enabling /Wp64,
which is used to detect portability problems on Visual Studio when
doing x86->x64 code builds.
https://bugzilla.gnome.org/show_bug.cgi?id=702788
When building with Meson, we cannot set environment variables while
running custom targets and our builddir layout is different from
Autotools anyway.
Now g-ir-scanner and friends can autodetect when they're being run
uninstalled by Meson and will find _giscanner.so and the giscanner
python files in the build directory. This is very similar to what
gdbus-codegen uses in glib/gio.
Same for girepository/gdump.c.
glib_dep is what is actually needed to #include <glib.h>, not
gobject_dep. It works incidentally with system gobject/glib but not
when built via subprojects.
If not done, it would leak the memory as address sanitizer reports:
==1294==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x7fa7a94b7602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x44c7a7 in __config_new girepository/cmph/cmph_structs.c:11
#2 0x44aaa7 in cmph_config_new girepository/cmph/cmph.c:291
#3 0x446fb5 in _gi_typelib_hash_builder_prepare girepository/gthash.c:114
#4 0x406cf7 in add_directory_index_section girepository/girmodule.c:270
#5 0x409ee6 in _g_ir_module_build_typelib girepository/girmodule.c:546
#6 0x404ada in main tools/compiler.c:217
#7 0x7fa7a70d482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
==4091==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x7fc20c854602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x44a3f3 in cmph_io_vector_new girepository/cmph/cmph.c:228
#2 0x44a965 in cmph_io_vector_adapter girepository/cmph/cmph.c:276
#3 0x446f9f in _gi_typelib_hash_builder_prepare girepository/gthash.c:113
#4 0x406cf7 in add_directory_index_section girepository/girmodule.c:270
#5 0x409ee6 in _g_ir_module_build_typelib girepository/girmodule.c:546
#6 0x404ada in main tools/compiler.c:217
#7 0x7fc20a47182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
This reverts commit e81c4681cc88a00fcd841c5a68d860d3714b55d7
The GI_TYPELIB_PATH envvar will still allow overriding the default
typelib dir (based on gobject-introspection libdir), but applications
will have the last say about typelib lookup directories. The resulting
lookup order is now:
- Paths added through g_irepository_prepend_search_path()
- Paths in GI_TYPELIB_PATH
- The default gobject introspection lookup dir
This makes g_irespository_prepend_search_path() work as announced
despite environment variables. If any application was relying on
GI_TYPELIB_PATH overriding the paths of this function call (for e.g.
make check, or to be able to run code inside the project tree), it
is encouraged to set up a similar envvar for their application specific
lookup dir, or perform this override through other means.
https://bugzilla.gnome.org/show_bug.cgi?id=765735