Commit Graph

29506 Commits

Author SHA1 Message Date
Ondrej Holy
c7254fb3ad gunixmounts: Use mnt_monitor_veil_kernel option
The previous commit enabled the `/run/mount/utab` monitoring. The problem
is that the `mount-changed` signal can be emitted twice for one mount. One
for the `/proc/mounts` file change and another one for the `/run/media/utab`
file change. This is still not ideal because e.g. the `GMount` objects for
mounts with the `x-gvfs-hide` option are added and immediately removed.
Let's enable the `mnt_monitor_veil_kernel` option to avoid this.

Related: https://github.com/util-linux/util-linux/pull/2725
2024-01-31 14:53:42 +01:00
Ondrej Holy
1abbbd761e gunixmounts: Use libmnt_monitor API for monitoring
The `GUnixMountMonitor` object implements monitoring on its own currently.
Only the `/proc/mounts` file changes are monitored. It is not aware of the
`/run/mount/utab` file changes. This file contains the userspace mount
options (e.g. `x-gvfs-notrash`, `x-gvfs-hide`) among others. There is a
problem when `/sbin/mount.<type>` (e.g. `mount.nfs`) helper programs are
used. In that case, the `/run/mount/utab` file is updated later than the
`/proc/mounts` file and thus the `GUnixMountMonitor` clients (e.g.
`gvfs-udisks2-volume-monitor`, `gvfsd-trash`) don't see the userspace
options until the next `mount-changed` signal. Let's use the `libmnt_monitor`
API for monitoring instead and emit the `mount-changed` signal also when the
`/run/mount/utab` file is changed.

Related: https://issues.redhat.com/browse/RHEL-14607
Related: https://github.com/util-linux/util-linux/pull/2607
2024-01-31 14:53:42 +01:00
Emmanuele Bassi
74a584e25a Merge branch 'fix-dist-docs' into 'main'
ci: Fix tarballing the docs on dist

See merge request GNOME/glib!3803
2024-01-22 10:45:15 +00:00
Philip Withnall
aee343fe5c Merge branch 'auto-lock' into 'main'
Add G_*_AUTO_LOCK macros

Closes #3223

See merge request GNOME/glib!3822
2024-01-21 21:02:35 +00:00
Philip Withnall
ca0e7c376a Merge branch 'compile-windows-resources-only-shared' into 'main'
gio, gmodule, gthread: compile windows resources only in shared build

See merge request GNOME/glib!3842
2024-01-21 20:42:15 +00:00
Hailey Somerville
c65e163240 gio, gmodule, gthread: compile windows resources only in shared build
When linking static libraries, multiple resources is an error unless
handled in a special way. glib and gobject do not have this problem,
as they already only include resources when building a shared lib.
2024-01-21 18:51:52 +11:00
Michael Catanzaro
75310f658d Merge branch 'alatiera/gmessage-docs' into 'main'
docs: Fix member names of GLib.LogLevelFlags

See merge request GNOME/glib!3841
2024-01-19 17:33:56 +00:00
Jordan Petridis
a011dd0048 docs: Fix member names of GLib.LogLevelFlags 2024-01-19 19:04:04 +02:00
Simon McVittie
62ee8bf693 Merge branch 'wip/smcv/clean-girepository-abi' into 'main'
girepository: Exclude private symbols from the ABI

See merge request GNOME/glib!3840
2024-01-19 12:22:45 +00:00
Emmanuele Bassi
3706ad526e Merge branch 'wip/smcv/typo' into 'main'
gvarianttype: Fix typos

See merge request GNOME/glib!3839
2024-01-19 12:15:43 +00:00
Simon McVittie
25ec19723c girepository: Exclude private symbols from the ABI
This removes the gthash utility functions from the ABI, so link those
into their automated test statically.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-19 12:07:30 +00:00
Simon McVittie
6da5e6a327 gvarianttype: Fix typos
Saying that a GtkWidget is a GtkWidget is trivially true, but not the
point we were trying to make here.

Fixes: b5c07063 "docs: Use code for class names in links"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-01-19 11:53:00 +00:00
Emmanuele Bassi
4ff4f073a4 Merge branch 'altiera/docs' into 'main'
docs: Fix links to symbols outside the allowed namsepace

See merge request GNOME/glib!3809
2024-01-18 18:35:21 +00:00
Marco Trevisan
7cd819126a Merge branch 'test-improvements' into 'main'
tests: A couple of test isolation improvements

See merge request GNOME/glib!3837
2024-01-18 16:27:12 +00:00
Philip Withnall
64e630e132 tests: Disable crash reporting in g_error() path in testing-helper
This avoids four coredumps being processed for every run of the
`testing` unit tests (which test `GTest`).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 15:23:53 +00:00
Philip Withnall
5c05dfad97 tests: Run more appinfo tests under a GTestDBus environment
I ran Bustle/dbus-monitor on the session bus while running the full GLib
test suite, and noticed that these tests were causing `Launched` signal
emissions on the main session bus. That suggested they weren’t isolated
properly, which at best causes noise on the bus and at worst could cause
spurious test failures.

Fix that by running those tests in a `GTestDBus` environment, as some of
the other appinfo tests already are.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 15:22:30 +00:00
Philip Withnall
217e25ac67 Merge branch '3216-girepository-casting' into 'main'
girepository: Rearrange type hierarchy and add type casting and checking macros

Closes #3216

See merge request GNOME/glib!3836
2024-01-18 14:53:43 +00:00
Philip Withnall
b13d8883b8 Merge branch '3155-girepository-more-api-cleanups' into 'main'
girepository: Change various alignments to use size_t

See merge request GNOME/glib!3833
2024-01-18 14:50:42 +00:00
Emmanuele Bassi
a899933acb Merge branch 'lcov-clear' into 'main'
build: Ignore branches in g_clear_*() functions under lcov

See merge request GNOME/glib!3835
2024-01-18 13:58:21 +00:00
Philip Withnall
993eae63ab tests: Use g_assert_*() rather than g_assert() in gthash tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 13:15:22 +00:00
Philip Withnall
9cbe5ae67d tests: Add tests for several GIBaseInfo subclasses
They get at least these `GIBaseInfo` subclasses up to a reasonable (but
not complete) coverage level.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 13:15:22 +00:00
Philip Withnall
9aea530ac0 gibaseinfo: Add initialiser macro for GIAttributeIter
Makes it a little easier to use.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 13:15:22 +00:00
Philip Withnall
57d64b111f girepository: Add type-checking cast macros
These follow GObject conventions, using `G_TYPE_CHECK_INSTANCE_CAST` to
cast to the given type, and potentially performing some runtime checks
of the type instance’s `GType` too.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
9debaffe0e gibaseinfo: Remove need for casting for gi_base_info_ref() and unref()
Just like is done with `g_object_{ref,unref}()`, make these functions
take a `void*` rather than a `GIBaseInfo*`, since they’ll most likely be
called with a type which is derived from `GIBaseInfo*` rather than a
`GIBaseInfo*` itself.

Add some runtime type checks to make up for lowering the compile time
type safety.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
5423bf4df7 girepository: Rework IS_(type) macros to use G_TYPE_CHECK_INSTANCE_TYPE
This means they’re now using the `GType` type system rather than the old
`GIInfoType` type system. Given the preceding few commits, these two
systems should now be equivalent.

This makes the type handling more conventional and hence a bit simpler
for people to use if they have experience with GObject.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
a99a35ab39 giregisteredtypeinfo: Make abstract and add subtypes
There are various info types which were previously treated as subtypes
of `GIRegisteredTypeInfo` by the runtime type system in the old version
of libgirepository.

Change the new type tree to reflect that, making several types now be
subtypes of `GIRegisteredTypeInfo`, and making `GIRegisteredTypeInfo`
abstract.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
7228c6d3e0 giboxedinfo: Add a tag type for boxed types
Boxed types are already represented within `GIInfoType`, so they should
have a `GType` representation as well.

In an upcoming commit, this will allow us to represent the subtype
relation between `GIBoxedInfo` and `GIRegisteredTypeInfo` too.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
eafc35e5ed gienuminfo: Split out GIFlagsInfo as a derived type
Flag enums are already treated as a special kind of enum within
`GIInfoType`, so it would be tidier to give it its own `GType` too, with
a subtype relation to `GI_TYPE_ENUM_INFO`.

This will simplify implementing `GI_IS_ENUM_INFO` in a following commit
too.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
d82675ffd3 gicallableinfo: Make abstract and add derived types
Previously (and incorrectly), `GICallableInfo`, `GIFunctionInfo`,
`GICallbackInfo`, `GISignalInfo` and `GIVFuncInfo` were all derived
directly from `GIBaseInfo`. `GICallableInfo` is supposed to represent
all of the other types, though, so that type hierarchy was incorrect. It
dated from when all the types were aliases of each other and the type
management was done entirely at runtime.

Fix that by making the other four types derive from `GICallableInfo`,
and marking `GICallableInfo` as abstract.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
4d5b6599fc gibaseinfo: Allow parent types to be specified for derived types
This doesn’t change the type hierarchy for now (i.e. it introduces no
functional changes), but it will allow us to add some intermediate types
into the `GIBaseInfo` hierarchy in an upcoming commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
71a19a6f65 gibaseinfo: Allow type flags to be specified for derived types
This doesn’t change any of the flags for now (i.e. it introduces no
functional changes), but it will allow us to make some of the types
abstract in an upcoming commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
8e3d98fc98 girepository: Add get_type() wrapper macros
This makes `GIBaseInfo` and derived types more consistent with GObject
convention, and thus a bit more comfortable to use.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3216
2024-01-18 13:15:22 +00:00
Philip Withnall
9377a0dd54 girepository: Split GIValueInfo out of gienuminfo.c
It’s a separate type, so it would be less confusing if it were in its
own file.

This doesn’t change any API.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3155
2024-01-18 13:15:22 +00:00
Philip Withnall
515b3fc1dc giroffsets: Uniformly handle alignments as size_t
Do this by tracking the state of the size/alignment calculations
separately, rather than bunging it into the `alignment` field using
magic values.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3155
2024-01-18 13:09:29 +00:00
Philip Withnall
60a9991f72 build: Ignore branches in g_clear_*() functions under lcov
It’s not useful for lcov to demand branch coverage of all branches
within `g_clear_*()` functions (such as `g_clear_pointer()`). By
choosing to use `g_clear_*()`, the programmer explicitly doesn’t care
about whether the pointer is `NULL`. The tests shouldn’t have to either.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 13:06:10 +00:00
Xavier Claessens
9e8f07b156 Add G_*_AUTO_LOCK macros
It is common to declare a mutex locker variable and to not use it in the
scope. That causes clang to warn about unused variable which is not
entirely true since the cleanup function IS the intended usage.

Work around that issue with a new macro that uses G_GNUC_UNUSED and
has the extra advantage of being less verbose.

Fixes: #3223.
2024-01-17 08:57:12 -05:00
Philip Withnall
9fcec66115 giarginfo: Return indexes as uints
As with previous commits, don’t use up half the return value space to
indicate an invalid index.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3155
2024-01-17 10:36:45 +00:00
Philip Withnall
fe6f9a661b gitypeinfo: Change gi_type_info_get_array_length_index() to return uint
Rather than mixing `-1` and valid indexes, split out the indication of
whether the type is an array with a length argument from the actual
index of the length argument.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3155
2024-01-16 23:26:02 +00:00
Philip Withnall
33f157bd6b gitypeinfo: Remove invalid return value from gi_type_info_get_array_type()
`-1` isn’t part of `GIArrayType`, so it’s not particularly type safe to
return it from `gi_type_info_get_array_type()`. Instead, make it an
error to call that function on a type which isn’t an array type.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3155
2024-01-16 23:17:19 +00:00
Philip Withnall
6a7806da4d gitypeinfo: Change gi_type_info_get_array_fixed_size() to return size_t
Return information about whether the type is a fixed-size array
separately from the array size, which allows us to use the full `size_t`
for the array size.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3155
2024-01-16 23:13:01 +00:00
Marco Trevisan
1b32e72073 Merge branch 'posix-memalign-zero' into 'main'
gvariant-core: Don’t call posix_memalign() with size==0

See merge request GNOME/glib!3831
2024-01-16 18:52:21 +00:00
Philip Withnall
bb37da24a6 Merge branch 'gir-standard-types' into 'main'
girepository: Use standard types instead of glib specific

See merge request GNOME/glib!3780
2024-01-16 18:43:54 +00:00
Marco Trevisan (Treviño)
6cc655f86e girepository: Use single-bit sized elements for the GIIrNode structures
Leave to the compiler some more hints to optimize these structures for
being packed when possible.
2024-01-16 18:56:57 +01:00
Marco Trevisan (Treviño)
e9bdbfaf4b cmph-bdz-test: Use more size_t 2024-01-16 18:56:57 +01:00
Marco Trevisan (Treviño)
a201cbd719 girepository: Various indentation cleanups
Various random syntax cleanups found while refactoring
2024-01-16 18:56:57 +01:00
Marco Trevisan (Treviño)
b68857e707 giroffsets: Use size types for size and alignments
Note that for alignments we should actually use size_t, but this would
imply some refactors since this value can be acually set to -1 in our
implementation.

So we use gssize for now, that at least on gcc is defined.
2024-01-16 18:55:45 +01:00
Marco Trevisan (Treviño)
223acf44ba gitypelib: Replace gi_typelib_check_format with compile-time static checks only
There's no much time to have checks at runtime when the compiler can
make sure that the structures size match the expected ones.
2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
c8eeca9492 girnode: Use size_t to compute gir node size and ensure value is valid 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
a73cc6d5a2 girepository: Use size_t to keep track of the number of interfaces 2024-01-16 18:40:42 +01:00
Marco Trevisan (Treviño)
bd29b0bf65 gtypelib: Use size_t for size-related arguments 2024-01-16 18:40:42 +01:00