Commit Graph

27606 Commits

Author SHA1 Message Date
Michael Catanzaro
5d738ddcfe Audit and fix incorrect use of (closure) in glib
Following Emmanuele's instructions for use of introspection annotations:

https://www.bassi.io/articles/2023/02/20/bindable-api-2023/

I have audited all uses of the (closure) annotation in glib and
determined that only a handful are correct. This commit changes almost
all of our use of (closure) annotations to conform to Emmanuele's rules.
2023-07-21 19:03:57 +01:00
António Fernandes
28dd5f017d strfuncs: Add missing ownership annotations for returned string vectors 2023-07-21 18:47:52 +01:00
Allison Karlitskaya
55abdd5e4a GVariant: add probes for SystemTap
https://bugzilla.gnome.org/show_bug.cgi?id=662779
Fixes: #473
2023-07-21 18:40:13 +01:00
Philip Withnall
3ab16a0d18 Merge branch 'libintl_fallback' into 'main'
meson: Allow forcing fallback for libintl

Closes #3048

See merge request GNOME/glib!3497
2023-07-21 16:44:56 +00:00
Allison Karlitskaya
766663dafe GPrivate: eliminate a malloc for pthread_key_t on most platforms
We don't know how big a pthread_key_t is, so we malloc() a big enough
chunk of memory for it and store a pointer into the GPrivate struct.

It turns out, on Linux, pthread_key_t is just an int, so we could much
easier just store it directly into the struct.

https://bugzilla.gnome.org/show_bug.cgi?id=737445
Fixes: #931
2023-07-21 17:12:01 +01:00
Allison Karlitskaya
256b195ff1 GPrivate: change return type of internal function
g_private_get_impl() was returning a pointer to the pthread_key_t, but every
function using this was immediately dereferencing it.  Change it so that we
dereference the value in the helper function and return it by value.

https://bugzilla.gnome.org/show_bug.cgi?id=737445
2023-07-21 17:03:31 +01:00
Michael Catanzaro
a552bf5694 Merge branch 'revert3356' into 'main'
Revert "build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags"

See merge request GNOME/glib!3504
2023-07-20 15:20:58 +00:00
Philip Withnall
9cb52d9f3b Merge branch '3045-multiarch-tests' into 'main'
tests: Fix pkg-config test for multiarch binaries on multiarch systems

Closes #3045

See merge request GNOME/glib!3506
2023-07-20 13:29:51 +00:00
Philip Withnall
2b391227e6 tests: Fix pkg-config test for multiarch binaries on multiarch systems
The test was passing fine when `bindir` was equal to `multiarch_bindir`,
but not when they differ.

For example, on a Debian system, `gio-querymodules` is installed to
`/usr/lib/x86_64-linux-gnu/glib-2.0/gio-querymodules` rather than
`/usr/bin/gio-querymodules` as it is on (say) Fedora.

This was causing the pkg-config tests to fail on Debian.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #3045
2023-07-20 13:30:34 +01:00
Philip Withnall
04f81e167e Merge branch 'subprojects-dir' into 'main'
meson: help gobject-introspection locate source and build dirs

See merge request GNOME/glib!3505
2023-07-20 12:22:38 +00:00
Philip Withnall
b16e682112 Merge branch 'keyfile-regression-3047' into 'main'
gkeyfile: Fix regression #3047 (group comment)

Closes #3047

See merge request GNOME/glib!3498
2023-07-20 11:59:07 +00:00
Andoni Morales Alastruey
dc37ca70fe meson: help gobject-introspection locate source and build dirs
gobject-introspection is currently assuming glib subproject
is in unversioned, but gstreamer uses a versioned directory, eg:
subprojects/glib-2.74.1 instead of subprojects/glib
2023-07-20 10:49:26 +02:00
Harald van Dijk
6e29fbec2d
Revert "build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags"
This reverts commit 004f48f4fc.

Per the discussion on #3356, this change was prompted by a
misunderstanding of ldflags/link_args, and it resulted in various other
packages using glib no longer getting symbols exported. This commit
restores the glib 2.76 behaviour.
2023-07-18 18:26:49 +01:00
Marco Trevisan
674f2a030c Merge branch '3054-context-return' into 'main'
gmain: Add a missing return on error path in g_main_context_release()

Closes #3054

See merge request GNOME/glib!3501
2023-07-18 10:57:32 +00:00
Philip Withnall
c67dd9d3fe gmain: Add a missing return on error path in g_main_context_release()
This should have been in commit
3926af723a.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #3054
2023-07-18 11:31:01 +01:00
Philip Withnall
741a561c4d Merge branch 'supported-platforms-docs' into 'main'
docs: Expand supported platforms documentation a little

See merge request GNOME/glib!3485
2023-07-14 11:57:03 +00:00
Brendan Shanks
d0862c3692 meson: Allow forcing fallback for libintl
Closes #3048
2023-07-13 10:02:04 -07:00
Philip Withnall
5d6c044da4 Merge branch 'wip/corey/codegen-typecheck' into 'main'
gdbus-codegen: Error on invalid dbus types

See merge request GNOME/glib!3495
2023-07-13 10:06:08 +00:00
Gaël Bonithon
51dfb3c229 gkeyfile: Skip group comment when adding a new key to a group
An oversight in 86b4b045: since the comment of group N now consists of
the last null-key values of group N-1, these keys must obviously be
skipped when adding a new non-null key to group N-1.

Closes: #3047
Fixes: 86b4b0453e
2023-07-13 10:32:18 +02:00
Gaël Bonithon
c49502582f gkeyfile: Ensure we don't add extra blank line above new group
A forgotten edge case in 86b4b045: when the last value of the last group
has been added via g_key_file_set_value() and it contains line breaks.
The best we can do in this case is probably to do nothing.

Closes: #3047
Fixes: 86b4b0453e
2023-07-13 10:32:18 +02:00
Corey Berla
a1a00a3071 gdbus-codegen: Error on invalid dbus types
Introduce slightly modified (dbus specific) versions of
variant_is_signature and variant_type_string_scan in order to fail
early on bad type strings.
2023-07-12 15:33:22 -07:00
Philip Withnall
f4df750075 Merge branch 'ptr-array-sort' into 'main'
garray: Fix typo in doc comment of g_ptr_array_sort[_with_data]()

See merge request GNOME/glib!3496
2023-07-12 12:32:43 +00:00
Alynx Zhou
57b0e72c7b garray: Fix typo in doc comment of g_ptr_array_sort[_with_data]()
Although g_ptr_array_sort_with_data() could achieve the goal, the
wrapper functions should be expected there because that's the reason
why they are added.
2023-07-11 22:42:33 +08:00
Marco Trevisan
4aa63defdf Merge branch 'ci-fetch-submodules' into 'main'
ci: Manually fetch submodules for style-check CI jobs

See merge request GNOME/glib!3494
2023-07-07 09:55:37 +00:00
Philip Withnall
11a3b5dc44
2.77.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-07-07 00:16:29 +01:00
Philip Withnall
840d8c3457 ci: Manually fetch submodules for style-check CI jobs
This works around GitLab issue
https://gitlab.com/gitlab-org/gitlab/-/issues/391756, which manifests as
the error message:
```
Updating/initializing submodules...
Submodule 'subprojects/gvdb' (https://gitlab-ci-token:[MASKED]@gitlab.gnome.org/GNOME/gvdb.git) registered for path 'subprojects/gvdb'
Synchronizing submodule url for 'subprojects/gvdb'
fatal: not a git repository: subprojects/gvdb/../../.git/modules/subprojects/gvdb
```
on between 1/10 to 1/2 CI runs.

See the GitLab issue for a writeup.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-07-06 16:32:44 +01:00
Marco Trevisan
4cf6c78512 Merge branch 'codegen-docs' into 'main'
gdbus-codegen: Fix some minor typos in the documentation

See merge request GNOME/glib!3477
2023-07-05 11:58:20 +00:00
Philip Withnall
9dd477dd77 Merge branch '3039-android-statx' into 'main'
glocalfileinfo: Fix incorrect use of struct statx.st_mtimensec on Android

Closes #3039

See merge request GNOME/glib!3482
2023-07-04 16:14:33 +00:00
Bruce Cowan
95624caa6c Update British English translation
(cherry picked from commit 2d3bcc9401)
2023-07-02 20:09:22 +00:00
Philip Withnall
4ef693a457 Merge branch 'gdbus-marshallers' into 'main'
gdbus-codegen: Generate specific marshallers for each required type

Closes #3028

See merge request GNOME/glib!3491
2023-07-02 16:30:21 +00:00
Marco Trevisan (Treviño)
27b7559c91 gdbus-codegen: Define only one marshaller per signature reusing across interfaces
Avoid generating more code than needed, so other than continuing using
the generic glib marshallers when possible, define once the custom ones
we need for each file we generate.

The marshallers are then re-used across all the interfaces defined
without duplicating the code size.
2023-06-30 23:40:03 +02:00
Marco Trevisan (Treviño)
23180d433e gdbus-codegen: Try to reuse default glib marshallers for simpler signals marshallers
If a signal signautre is simple enough we can just reuse the default
marshallers by simply creating a wrapper marshaller
2023-06-30 22:59:37 +02:00
Marco Trevisan (Treviño)
c5d9004236 gdbus-codegen: Use direct-access GValue macros for marshallers and GValues
This is the same we're doing in code generated by glib-genmarshaller and
what gmarshal does internally.

Since the generated gdbus C code can be considered private too, this is
safe to do, and will allow faster access to GValue objects.
2023-06-30 22:59:37 +02:00
Marco Trevisan (Treviño)
8943ceae6c gdbus-codegen: Generate marshallers for method handlers signals
Get rid completely of the usage of the generic marshaller in gdbus
generated code, using instead specific marshallers.

Code is not yet optimized fully since we may still have duplicated
functions to be generated.

Closes: https://gitlab.gnome.org/GNOME/glib/-/issues/3028
2023-06-30 22:59:37 +02:00
Marco Trevisan (Treviño)
6de362fcae gdbus-test-codegen: Add test to check that fd lists can be passed
Add a simple implementation to check that fd-passing works when using
generated code, this is going to be useful to test special marshalling
case.
2023-06-30 22:59:37 +02:00
Marco Trevisan (Treviño)
3d313147f0 gio/test-codegen: use valid interface name for FdPassing test
So that it can be ran for real, not only tested for generation
2023-06-30 22:59:37 +02:00
Marco Trevisan (Treviño)
7b750972e8 meson/gio: Increase timeout for the codegen python tests
It's adding more stuff, let's ensure it wont timeout for no reason in
some platforms.

As per this mark also it as 'slow'
2023-06-30 22:59:25 +02:00
Marco Trevisan (Treviño)
1cd5c5678a gdbus-codegen: Generate signal marshallers for each interface signal
We relied on g_cclosure_marshal_generic() to easily generate signal
marshallers, but this relies on inspecting each parameter type with ffi
and this implies a performance hit, other than breaking the stack-frame
unwinder used by Linux perf and so by sysprof.

Given that we know the types we work on, it's easy enough to generate
the marshallers ourself.

Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/3028
2023-06-30 22:17:46 +02:00
Marco Trevisan (Treviño)
51c023f189 tests/codegen: Add checks for signal emission enums
These are checked to be correct by code compilation, but let's ensure we
also have some kind of forma check on the expected syntax.
2023-06-30 22:17:46 +02:00
Marco Trevisan (Treviño)
4b05e06e1c gdbus-codegen: Address more black cleanups 2023-06-30 22:17:46 +02:00
Marco Trevisan (Treviño)
1b345e411f meson: Add all the gdbus-codegen based tests to the proper suite
So it's easier to run them all with --suite=gdbus-codegen
2023-06-30 18:11:18 +02:00
Philip Withnall
ec754e5404 Merge branch 'fix-custom-dispatch-32bit-windows' into 'main'
gobject/tests: Fix running on 32-bit Windows

See merge request GNOME/glib!3490
2023-06-30 14:05:55 +00:00
Luca Bacci
2dc0a43bc0 glocalfileinfo: Fix GLocalFileStat getters on MinGW x86
For some reason, `time_t` is defined as being 32 bits wide on that
platform, which causes truncation of the timestamps from `struct stat`.

Avoid that problem by consistently using a 64-bit return value from the
`struct stat` accessors.

Helps: #3039
2023-06-30 15:00:56 +01:00
Philip Withnall
2a077b30a4 Merge branch 'gdbus-emit-signal-ids' into 'main'
codegen: Use g_signal_emit to emit signals

See merge request GNOME/glib!3488
2023-06-30 09:27:00 +00:00
Chun-wei Fan
cb1eb57581 gobject tests: Fix running custom-dispatch on 32-bit Windows
UAC will terminate this test program from running in 32-bit x86 builds as
it believes that it will alter Windows.  In order to make this run, we
create a manifest file for 32-bit Windows builds in order to tell UAC
that this program should not need admin privileges.

This will allow the entire test suite for GLib to run on 32-bit Windows
builds.
2023-06-30 11:32:54 +08:00
Chun-wei Fan
ab732692a0 tools: Add script to create UAC manifests for Windows
This is copied from the GTK source tree to put into our builds so that
we can generate a manifest file to pacify UAC on Windows for 32-bit
builds, as UAC will kill any 32-bit processes that it believes will
be an installer or will alter the system in any ways.

This will be used to fix running the custom-dispatch test program on
32-bit Windows builds.
2023-06-30 11:32:44 +08:00
Michael Catanzaro
31565bbb02 Merge branch 'fix_mirror_char_direction' into 'main'
guniprop: fix param direction in g_unichar_get_mirror_char(), for introspection

See merge request GNOME/glib!3489
2023-06-29 22:11:55 +00:00
G.Willems
d8483ef696 guniprop: fix param direction in g_unichar_get_mirror_char(), for introspection 2023-06-29 23:55:08 +02:00
Marco Trevisan (Treviño)
88d48a7a22 codegen: Use g_signal_emit to emit signals
We were using emit_by_name which implies looking up for the signal name,
while the generated code can easily remember the signal ID and use it
instead, allowing direct access to the signal emission.
2023-06-29 22:20:05 +02:00
Marco Trevisan
39e018e151 Merge branch '3007-option-context-colons' into 'main'
goption: Clarify expected format of option group description in docs

Closes #3007

See merge request GNOME/glib!3481
2023-06-29 17:00:49 +00:00