These were leaking memory when dumping introspection data from projects
for building their GIR files. That’s generally not a problem, unless
you’re trying to build the project with -fsanitize=address, which causes
the GIR build phase to error out due to leaking memory.
https://bugzilla.gnome.org/show_bug.cgi?id=762653
This reverts commit 98bb6c91b710a95efe4cfeb303daeec3381b9c98.
It breaks programs simply executed *transitively* from a setuid
binary like the dbus daemon launch helper.
https://bugzilla.redhat.com/show_bug.cgi?id=1285991
Conflicts:
girepository/girepository.c
Add "n_field_callbacks" to ObjectBlob which represents the number of object
fields which are also callbacks. This a allows a constant time computation
for accessing sections after fields. Track writing of this field by passing
an extra argument through the girnode writers recursive call structure. This
essentally reverts a portion of commit 7027bb256d0d1ab which added a linear
time computation for accessing sections after fields.
Update typelib validator to also ensure n_field_callbacks is properly set.
https://bugzilla.gnome.org/show_bug.cgi?id=700338
Note that (direction [in]out) parameters are only pointers if the
underlying type being transferred is a pointer, i.e. if the formal
parameter is a pointer to a pointer or deeper.
https://bugzilla.gnome.org/show_bug.cgi?id=720201
We know of at least one privilege escalation path via
`GI_TYPELIB_PATH`. I don't want to audit for others. If someone
shows up with a use case we can talk.
https://bugzilla.gnome.org/show_bug.cgi?id=755472
This optimization is bugged and broken in the case of certain
libraries. GNOME uses a lot of prefixes with "G", so we'll almost always
have found the prefix.
This is specifically a problem for something like GXml.xDocument, which
uses a type name starting with a lower-case letter, which fools the
prefix logic, but we're also fooled by the "G" appearing in GLib and
Gio.
A more sophisticated version of this check would have three passes:
check prefix with type-case, check prefix without type-case, global
search, but this is an edge case and it doesn't feel worth it to write.
Generalize "throws" attribute to SignatureBlob which can be used by all
callable blob types. Keep FunctionBlob and VFuncBlob throw attributes
around and functional for compatibility. Refactor girwriter.c to write
out throws attribute for all callable types.
Based on a patch by Simon Feltman.
https://bugzilla.gnome.org/show_bug.cgi?id=729543
Add find_field utility function for finding a field info by name.
Beyond convenience, this should be faster than manually using
the get_n_fields and get_field functions because get_field does
an additional iteration for each field to calculate offsets O(n^2).
Thus find_field combines the offset and comparison
computations into a single loop O(n).
Based on a patch by Simon Feltman.
g_irepository_get_dependencies() is supposed to return the transitive
closure of all dependencies of the given namespace. However, it just
loads the dependencies field from the typelib, which is supposed to only
list immediate dependencies.
Introduce a new g_irepository_get_immediate_dependencies() which does
this, and rewrite g_irepository_get_dependencies() to build the
transitive closure of all its namespace dependencies. This does not
require loading any new typelibs, as the transitive closure of
dependencies should already have been loaded by g_irepository_require()
or g_irepository_load_typelib().
https://bugzilla.gnome.org/show_bug.cgi?id=743782
Make it clear that both the dependencies field in the typelib, and the
include elements in the GIR AST, are for immediate dependencies, not
transitive ones.
https://bugzilla.gnome.org/show_bug.cgi?id=743782
Use compiler directives for exporting symbols for the build of
libgirepository and also for the test libraries, like what is now done
in GLib and GTK+ so that maintaining a separate .symbols (and .def files)
would not be needed, in which the correct compiler directive is determined
during configure time. Drop all the .def files and the .symbols file as
we would not be using them anymore.
https://bugzilla.gnome.org/show_bug.cgi?id=732669
This adds a header to the girepository library, which is then included
either directly or indirectly by the other headers so that all the public
symbols (and the 2 symbols in gitypelib-internal.h used by the tools) are
decorated by a macro, that can later be used to export the symbols and also
to be used to display compile-time warnings for usage of deprecated APIs,
which is like what is now being done in GLib (and GTK+, Clutter, and so
on).
This marks the first step that we begin to stop depending on the .symbols/
.def files to export the symbols.
https://bugzilla.gnome.org/show_bug.cgi?id=732669
This includes config.h in all the C-sources of girepository so that we can
get the correct export directive from config.h during compile time and
therefore export the symbols as necessary, like what GLib and GTK+ is
currently doing.
https://bugzilla.gnome.org/show_bug.cgi?id=732669
Knowing the ownership transfer for instance parameters is
necessary for correct memory management of functions which
"eat" their instance argument, such as g_dbus_method_invocation_return_*.
Parse this information from the gir file and store in the
typelib, and then provide new API on GICallableInfo to
retrieve this.
https://bugzilla.gnome.org/show_bug.cgi?id=729662
Parse the 'nullable' attribute on parameters and function return types.
Additionally, tweak the meaning of the 'allow-none' attribute. We now
only treat it as equivalent to 'nullable' for non-out parameters. For
out parameters, we treat it to mean the same as the already-recognised
'optional' parameter (which we only recently started actually using).
https://bugzilla.gnome.org/show_bug.cgi?id=660879
Use ParseState enum instead of a boolean for the ParseContexts embedded_type
flag. This allows specific tracking of the embedded type currently being
parsed which can now either be STATE_STRUCT_FIELD or STATE_CLASS_FIELD (or
allow for future expansion). Add ParseState::STATE_NONE as the default for
this field.
Fix GObject FieldBlob validation to take into account the sizeof
CallbackBlobs (copied from the struct validator).
Add static g_object_info_get_field_offset which parallels
g_struct_info_get_field_offset which is needed since callback fields may
vary in size.
https://bugzilla.gnome.org/show_bug.cgi?id=725198
The typelib compiler was writing uninitialised memory to the output file.
There were two sources of this uninitialised memory: the hash writer included
some uninitialised memory in its output, and the bytes added after the hash
output for padding were also not being initialised.
Fix this by passing the padded size to the hash code writer function and
having that function initialise the entire memory region to zero before
writing.
https://bugzilla.gnome.org/show_bug.cgi?id=721177
Aliasing TRUE or FALSE is not very common, but done occasionally
for extra clarity. Namely G_SOURCE_REMOVE / G_SOURCE_CONTINUE are
self-explanatory, unlike the "raw" booleans.
https://bugzilla.gnome.org/show_bug.cgi?id=719566
Don't assume that the parent of a GIVFuncInfo is a GIObjectInfo,
it could be a GIInterfaceInfo, if the vfunc is part of interface
instead of a class.
https://bugzilla.gnome.org/show_bug.cgi?id=688375
- require GTK-Doc 1.19
- remove sgml mode
- automatically generate gi.types (needs GTK-Doc 1.19)
- fix https://bugzilla.gnome.org/show_bug.cgi?id=700025
[WIP] - rearange sections a bit
[WIP] - add gi-building, gi-programming sections
[WIP] - mark missing docs with TODO, which is only marginaly
better than nothing but at least can be grepped :)
https://bugzilla.gnome.org/show_bug.cgi?id=571648
GTK-Doc description fields for tags can contain multiple lines and
even multiple paragraphs. Whitespace cannot be preserved in XML
attributes, so we move the "deprecated" description text into
a "<doc-deprecated />" element right next to where we already have
the "<doc />" element. Keep the "deprecated" attribute around for
backwards compatibility though, but set its value to "1" (analogous
to the "writable", "contruct", etc attributes) if the annotated
symbol is marked as deprecated.
While at it, add <doc-version /> and <doc-stability /> which
was not yet available in the .gir files...
This takes care of the "Since:", "Stability:" and "Deprecated:"
GTK-Doc tags. Nothing needs to be done for the "Returns:" tag as
as we already write a "<doc />" child element on "<return-value />".
Update parser to use g_ascii_strcasecmp instead of strcmp. This fixes
incorrect flags being set when the incomming gir is using lowercase values
for the "when" attribute.
https://bugzilla.gnome.org/show_bug.cgi?id=709462
vala generates this, and we need to honor it now that we're using the
c:prefix as an optimization when searching for gtypes.
https://bugzilla.gnome.org/697759
When g_irepository_find_by_gtype() doesn't succeed on a simple prefix
match (the current 'fastpass' mechanism), it ends up taking a
considerable amount of CPU time, traversing the contents of all typelibs.
I imagine that the reasons to have the exhaustive search fallback are
not as strong as they used to be. For example, the case mentioned
(Clutter including Cogl) no longer seems to be true.
Also, typelibs (as generated by g-ir-scanner) now provide
comma-separated C prefix info for cases when the typelib includes
introspection info for multiple prefixes. For example, the Sugar typelib
has a c_prefix string of Sugar,EggSM,Gsm,Acme. So I imagine there are
not many remaining justified cases where the exhaustive search is needed.
With that in mind, I found two ways to optimize this function:
1. Support comma-separated C prefixes
2. Don't bother with an exhaustive search if we did find a typelib
claiming support for the prefix. For example, if we're looking for
GdkDeviceManagerXI2 (currently non-introspectable) and we already found
typelib files providing the 'Gdk' prefix that didn't offer this, lets
not bother with the exhaustive search, we aren't going to find anything.
They could be freed in separate threads (e.g. language binding GC
thread). But no particular reason to change other than noticing it
during code inspection for a different bug.
https://bugzilla.gnome.org/show_bug.cgi?id=688694
Previously we would require applications that shipped with private
typelibs to add the private path to LD_LIBRARY_PATH, or to have a
launcher binary with the right RPATH.
Now they can just call GIRepository.prepend_library_path() before
they access the module.
https://bugzilla.gnome.org/show_bug.cgi?id=694485