31364 Commits

Author SHA1 Message Date
Philip Withnall
06077435c9
gfilemonitor: Emit GObject::notify by pspec rather than property name
This is equivalent, but slightly faster, as it avoids a pspec lookup.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-02-13 18:57:58 +00:00
Philip Withnall
8ffdbb55d9
gfilemonitor: Install properties all at once
This is a minor performance improvement, since the pspec list for the
class now only has to be modified once, rather than twice.

It also means we now have the `GParamSpec` pointers to hand in a `props`
array, which will be used in the upcoming commits.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-02-13 18:57:04 +00:00
Philip Withnall
5aa42683ee
gfilemonitor: Use an enum for properties to allow -Wswitch-enum
This lets the compiler tell us if we’ve accidentally missed a property
implementation from `get_property()` or `set_property()`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-02-13 18:56:04 +00:00
Philip Withnall
40fd0e4759 Merge branch 'wip/3v1n0/gfilemonitor-atomic-cancelled' into 'main'
gio/gfilemonitor: Use atomic API to get / store cancelled state

See merge request GNOME/glib!4487
2025-02-13 18:43:50 +00:00
Philip Withnall
2fab2c38ff Merge branch 'rafaelff/update-pt_BR' into 'main'
Update Brazilian Portuguese translation

See merge request GNOME/glib!4491
2025-02-13 18:39:36 +00:00
Rafael Fontenelle
2e928adfd1 Update Brazilian Portuguese translation 2025-02-13 16:43:55 +00:00
Marco Trevisan (Treviño)
795a56d623 gio/gfilemonitor: Reorder includes as expected by syntax checker 2025-02-13 15:03:57 +01:00
Marco Trevisan (Treviño)
175e02f15c gio/gfilemonitor: Do not mark the filemonitor cancelled until vfunc is done
As per previous commit we used atomic logic to handle the cancellation,
but that lead to a slightly different behavior because the file monitor
was then marked as cancelled before the vfunc implementation was called.

Use similar behavior now (by still relying on the atomic logic), by
marking the state as about-to-cancel as soon as we're starting the
cancellation (preventing other threads to cancel it), and eventually
fully marking it as cancelled.
2025-02-13 15:03:57 +01:00
Marco Trevisan (Treviño)
218b298a1b gio/gfilemonitor: Use atomic API to get / store cancelled state
The cancelled state may be set and read by different threads, so ensure
that it's stored and managed in an atomic way.

We could in fact end up check for `g_file_monitor_is_cancelled()` in a
thread and `g_file_monitor_cancel()` or `g_file_monitor_emit_event` in
in another one.
2025-02-13 15:03:57 +01:00
Philip Withnall
3c03076ac5 Merge branch 'unify-tests-launcher-scripts' into 'main'
tests: Cleanup python tests and add tests for gi-compile-repository and gi-inspect-typelib

See merge request GNOME/glib!4476
2025-02-12 17:00:15 +00:00
Marco Trevisan (Treviño)
fe25e4aad5 tests/lib/testprogramrunner: Support overriding the environment 2025-02-12 17:37:25 +01:00
Marco Trevisan (Treviño)
044e77a384 girepository/tests: Add tests for basic inspector operations
Add some initial tests for the inspector
2025-02-12 17:37:25 +01:00
Philip Withnall
23948a4db5
gkeyfile: Convert docs to gi-docgen linking syntax
Improve formatting while I’m there, and try and ensure all the docs in
these two files matches the
[guidelines](https://developer.gnome.org/documentation/guidelines/devel-docs.html#writing-api-references).

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

Helps: #3250
2025-02-12 11:34:20 +00:00
Philip Withnall
7ca70303b7
gkeyfile: Add missing (transfer full) annotations to ref/free functions
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-02-12 11:31:10 +00:00
Philip Withnall
9c5409e229
gkeyfile: Update links to various fdo specifications
The old links still work, but we might as well avoid a redirect.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-02-12 11:31:03 +00:00
Philip Withnall
3e5c454a02
gkeyfilesettingsbackend: Convert docs to gi-docgen linking syntax
Improve formatting while I’m there, and try and ensure all the docs in
these two files matches the
[guidelines](https://developer.gnome.org/documentation/guidelines/devel-docs.html#writing-api-references).

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

Helps: #3250
2025-02-12 11:30:55 +00:00
Marco Trevisan (Treviño)
6160747fe5 girepository/tests: Add tests for the compiler basic operations
Adding some initial test for the compiler behavior and its expected
output.

Also, when using sanitizers we want to be able to test the compiler memory
management.
2025-02-11 21:02:56 +01:00
Marco Trevisan (Treviño)
bf9ea337a2 girepository/tests: Add tests on compiler open/write failures 2025-02-11 21:02:56 +01:00
Marco Trevisan (Treviño)
26890fbb82 ci: Enable introspection for installed tests 2025-02-11 18:51:15 +01:00
Marco Trevisan (Treviño)
00ebf4e1eb tests/lib: Add a new unittest type to simplify launching test programs
We were reusing the same logic everywhere, while we can just reuse an
unique class to base our tests on that avoids having to copy-and-paste
code for no good reason
2025-02-11 18:51:15 +01:00
Marco Trevisan (Treviño)
4bcd99de43 tests: Avoid reusing and installing multiple files the taptestrunner
Add some basic support for having glib-tests-only python libraries that
can be shared across the various projects, so that we don't have to
maintain multiple copies of them.
2025-02-11 18:51:15 +01:00
Marco Trevisan
15edb1b07e Merge branch 'typo' into 'main'
meson: Fix typo in comment about python shebang

See merge request GNOME/glib!4486
2025-02-11 17:09:57 +00:00
Nirbheek Chauhan
8d07ae7ef1 meson: Fix typo in comment about python shebang 2025-02-11 21:37:49 +05:30
Philip Withnall
14a756ae97
gdbusconnection: Add g_dbus_connection_register_object_with_closures2() API
This replaces `g_dbus_connection_register_object_with_closures()`, and
becomes the new binding-friendly version of
`g_dbus_connection_register_object()`.

The problem with `g_dbus_connection_register_object_with_closures()` is
that the `method_call_closure` kept the reference counting semantics of
`GDBusInterfaceMethodCallFunc`, in that the `invocation` argument was
`(transfer full)`, even though it was wrapped in a `GClosure`. This
couldn’t be described in introspection annotations, so the
`GDBusMethodInvocation` was being leaked by bindings. Some bindings
added workarounds to fix the leak at our direction (see
https://gitlab.gnome.org/GNOME/glib/-/issues/2600#note_1385050), which
meant we could no longer change the reference counting behaviour without
breaking those bindings (see #3559).

So let’s start afresh with
`g_dbus_connection_register_object_with_closures2()`, with correctly
defined reference counting semantics (the `GDBusMethodInvocation` is
`(transfer none)`) from the start.

Unfortunately we can’t add a `(rename-to)` annotation to the new API, as
that would effectively be an API break for existing binding code which
uses the old API via that rename.

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

Fixes: #3560
2025-02-11 14:08:05 +00:00
Marco Trevisan
589c8295ea Merge branch 'callable-info-test-leak' into 'main'
tests: Fix a memory leak if a callable-info test is skipped

See merge request GNOME/glib!4483
2025-02-11 13:57:20 +00:00
Philip Withnall
ca760eeeac Merge branch 'windows-fix-shebang' into 'main'
Windows: fix Python path can contain spaces

Closes #3331

See merge request GNOME/glib!4391
2025-02-11 13:42:32 +00:00
Dan Yeaw
160e55575e Windows: fix Python path cannot contain spaces
Move the shebang line from the full Python path of the build
machine to the first Python on the path during runtime. Set
the shebang in the main meson.build file so that it can be
overridden in one place if needed.

Fixes: #3331
2025-02-11 11:57:30 +00:00
Philip Withnall
a127f9b7d2
tests: Fix a memory leak if a callable-info test is skipped
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-02-11 11:40:29 +00:00
Philip Withnall
8d51095602 Merge branch 'gkeyfile-fix-c-locale-handling' into 'main'
gkeyfile: Fix C locale handling

Closes #3578

See merge request GNOME/glib!4480
2025-02-11 09:31:33 +00:00
Gaël Bonithon
5cc6af2237 gkeyfile: Fix C locale handling
As gettext does:
* if C locale is used to set a value, set the untranslated value, i.e.
  key=value and not key[C]=value;
* if C locale is used to get a value, return the untranslated value,
  i.e. not the value from key[C]=value, if it ever exists, and do not
  consider C as an undefined locale otherwise.

Fixes: #3578
2025-02-11 09:31:33 +00:00
Philip Withnall
ba60ea7aa0 Merge branch 'amolenaar/docs-fixes' into 'main'
docs: Make docs more markdown-ish

See merge request GNOME/glib!4479
2025-02-10 14:40:55 +00:00
Arjan Molenaar
04acc1741b
docs: Make docs more markdown-ish
Fixed some issues that came to light while compiling documentation
for the python bindings.
2025-02-10 10:26:42 +01:00
Philip Withnall
0234f8e1b1 Merge branch 'ppd-api-rename' into 'main'
gio/powerprofilemonitordbus: Use newer D-Bus API

See merge request GNOME/glib!4478
2025-02-07 08:34:19 +00:00
Marco Trevisan (Treviño)
dba2d618d5 gio/tests/power-profile-monitor*.py: Use upower ppd daemon APIs 2025-02-07 00:55:35 +01:00
Marco Trevisan (Treviño)
71d08b707a gio/tests/power-profile-monitor-*.py: Fix style using black 2025-02-07 00:55:35 +01:00
Marco Trevisan (Treviño)
236abac6fb gio/powerprofilemonitordbus: Use newer DBus API
Since some time the power-profiles-daemon project has been moved under
the upower umbrella and renamed its API to follow that.

While the legacy name is still supported, there are plans to not support
it anymore in future [2]. So let's update GLib code to use the
current main name instead.

[1] https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/merge_requests/148
[2] https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/merge_requests/166
2025-02-07 00:55:32 +01:00
Michael Catanzaro
222546ddd0
gcancellable: remove sketchy source ref/unref
These refcount changes cannot possibly fix any race condition because
there is no guarantee that the g_source_ref() will be called in this
thread before any g_source_unref() that might happen on another thread.
We would have to take the ref sooner for it to be effective.

It's also not clear why we take a ref at all, since the source is
already being disposed and there's no explanation of why we should
resurrect it here. It can't be finialized until the call to dispose is
finished, so it's unclear what we are guarding against.

I'm not sure about the correctness of this code and make no promises
that there are no bugs here, but I think this change shouldn't make
anything worse.
2025-02-06 12:14:34 -06:00
Philip Withnall
00f54b1bcc Merge branch 'fix-docs-links' into 'main'
docs: Fix invalid references and broken links

See merge request GNOME/glib!4475
2025-02-06 12:38:51 +00:00
Mavroudis Chatzilazaridis
cb1502ed66 docs: Fix invalid references and broken links
This commit fixes quite a few broken links and references, minor typos,
and improves wording in some sections.
2025-02-05 22:28:26 +02:00
Michael Catanzaro
f5eb3fd716 Merge branch 'sysprof-leak' into 'main'
glib.supp: Ignore once-per-thread leak from SysprofCollector

See merge request GNOME/glib!4471
2025-02-05 17:33:40 +00:00
Philip Withnall
7fffe59037 Merge branch 'wip/pwithnall/soft-c11-dependency' into 'main'
build: Add a soft dependency on C11

See merge request GNOME/glib!4473
2025-02-04 16:35:33 +00:00
Philip Withnall
0445d555e0
docs: Stop mentioning outdated C versions in various docs
Link to the toolchain requirements, which are kept up to date, rather
than duplicating them across multiple documents.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-02-04 16:01:44 +00:00
Philip Withnall
445eea668a
build: Add a soft dependency on C11
This will warn if GLib is configured with a toolchain which doesn’t
support C11. We currently require C99. If nobody complains (as directed
by this warning) we will start to require C11 in the next unstable
release series (2.85).

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3574#note_1859924

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-02-04 15:59:51 +00:00
Philip Withnall
97fdba0d2f Merge branch 'cancellable-source-dispose-races' into 'main'
gcancellable: Ignore cancelled callback on disposed source

Closes #3448

See merge request GNOME/glib!4206
2025-02-04 14:40:56 +00:00
Philip Withnall
ff2c5c3e74
tests: Fix non-atomic accesses to atomic variables in cancellable test
As suggested by Marco Trevisan in !4206.

This might eliminate some spurious failures of the test.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-02-04 14:06:15 +00:00
Marco Trevisan (Treviño)
d7c8bb0726 gcancellable: Ignore cancelled callback on disposed source
Prevent to access to a disposed gsource in the GCancellable cancelled
signal callback.

Due to the fact that the signal is called in the same thread in which
the cancellable get cancelled, we may receive the callback just after
the GSource has been disposed or during its disposal.

To prevent this, let's pass to the signal a pointer to the source itself
and nullify atomically the first time we're calling a callback or
disposing it.

In case the dispose function wins the race, then the callback will just
do nothing, while the disposal will continue as expected.

In case the callback wins the race, during the concurrent disposal we'll
just wait for the callback to be completed, before returning the disposal
itself that will likely lead to freeing the GSource.

Closes: #3448
2025-02-04 13:01:03 +00:00
Philip Withnall
eec7ba6ef3 Merge branch '3592-dbus-serial-overflow' into 'main'
gdbusconnection: Prevent sending a serial of zero on overflow

Closes #3592

See merge request GNOME/glib!4470
2025-02-04 11:09:45 +00:00
Philip Withnall
62c1ae7161
glib.supp: Ignore once-per-thread leak from SysprofCollector
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-02-04 10:47:43 +00:00
Philip Withnall
f7a0e5f13f Merge branch 'wip/nacho/gregistry' into 'main'
Registry backend fixes

See merge request GNOME/glib!4468
2025-02-04 10:40:03 +00:00
Philip Withnall
8297bbc00c
gdbusmessage: Check that message serial is not set to zero
It’s disallowed by the D-Bus specification.

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

Helps: #3592
2025-02-04 10:32:44 +00:00