Commit Graph

31598 Commits

Author SHA1 Message Date
Philip Withnall
787f47f091 gfileinfo: Slightly expand docs for g_file_info_get_attribute_as_string()
Inspired by !4556.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-14 15:27:08 +00:00
Lukáš Tyrychtr
6b2187b5ef gio-tool: Fix handling of the trash original path
Previously, we were getting the string representation. However, this
representation gets escaped, which breaks non-ascii characters, because we
were counting on the path being the original path, which was not true in
these cases.

Retrieve it rather as the byte string which it is.

Fixes #3636.
2025-03-14 13:46:55 +01:00
Philip Withnall
ccc6748ca9 Merge branch 'such-a-cold-test' into 'main'
tests: Add a test for g_object_freeze_notify() being called too often

See merge request GNOME/glib!4555
2025-03-13 16:29:50 +00:00
Thomas Haller
67fa02bdcf gobject: destroy closure watches one by one
Previously, we would call

  g_datalist_id_set_data (&object->qdata, quark_closure_array, NULL);

which called destroy_closure_array() on the CArray.

At that point, it would iterate over the CArray, and invalidate all
closures. But note that this invokes external callbacks, which in turn
can destroy other closures, which can call object_remove_closure().
But now that closure can no longer be found and an assertion fails.

Instead of removing the entire CArray at once, remove each closure one
by one in a loop.

This problem is similar to issue 1002, except here it's about closure
watches instead of GWeakNotify.

Note that now we destroy closures one-by-one in a loop, and we iterate
the loop as long as we have closures. That makes a difference when a new
closure gets registered while we destroy them all. Previously, newly
registered closures would survive. It would be possible to implement the
previous behavior, but I think the new behavior is better. It is anyway
a very remote use case.
2025-03-13 17:23:55 +01:00
Philip Withnall
9fe6d8b5f0 tests: Disable socket-listener mock tests on macOS
Its symbol interposition works differently to that of Linux, so our
approach using `dlsym(RTLD_NEXT)` to inject syscalls (and still allow
chaining up to the version from libc) doesn’t work on macOS.

See https://gitlab.gnome.org/GNOME/glib/-/jobs/4861349 for an example
failure.

It would be lovely to have these tests working on macOS, but I am not a
macOS developer, and have spent enough time fixing this leak (#1250)
already. It can wait for follow-up work.

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

Helps: #1250
2025-03-13 13:25:19 +00:00
Philip Withnall
007c525d61 gsocketlistener: Minor cleanups to use g_clear_object() and friends
This should introduce no functional changes.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-13 13:25:13 +00:00
Philip Withnall
05e529f3f8 tests: Add tests for g_socket_listener_add_any_inet_port() algorithm
The algorithm that `g_socket_listener_add_any_inet_port()` and
`g_socket_listener_add_inet_port()` use to try to connect to IPv4 and/or
IPv6 ports are a bit complex (especially when port allocation has to
happen in the former method). So far they’ve not really been unit
tested, which is unfortunate, and has left latent bugs.

Add some unit tests for both methods, by providing mock `socket()` (and
friends) functions to override those from libc, and using those to cause
specific syscalls to fail according to the test’s needs.

These tests demonstrate the fix for #1250 works, as the tests can be run
under memcheck and show no memory leaks. They’ve revealed a follow-up
issue, though — `g_socket_listener_add_any_inet_port()` doesn’t try a
fallback IPv4-only socket if it tries an IPv6 socket and that socket
accepts IPv4 but then fails to `listen()`. I’ve filed issue #3604 for
that.

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

Helps: #1250
2025-03-13 13:25:06 +00:00
Philip Withnall
ff94b4b665 tests: Add a test for g_object_freeze_notify() being called too often
This tests the `g_critical()` path in it, to make sure we handle errors
acceptably there.

Prompted by https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4185#note_2377037

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-13 11:48:10 +00:00
Philip Withnall
435dd378fd tests: Use g_assert_*() rather than g_assert() in properties tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-13 11:47:48 +00:00
Philip Withnall
a2904b611e Merge branch 'l10n-id' into 'main'
Update Indonesian translation

See merge request GNOME/glib!4554
2025-03-13 00:38:09 +00:00
Andika Triwidada
fe330b0b31 Update Indonesian translation 2025-03-12 11:40:53 +00:00
Philip Withnall
89983f33b0 Merge branch 'ebassi/signal-flags-docs' into 'main'
docs: Document GSignalFlags members added after 2.0

See merge request GNOME/glib!4553
2025-03-12 11:16:06 +00:00
Emmanuele Bassi
3de213b622 docs: Document GSignalFlags members added after 2.0
Use separate doc blocks, to ensure that the "Since" tag is parsed and
reflected in the introspection data.
2025-03-12 11:34:30 +01:00
Philip Withnall
34608c9426 Merge branch 'Persian' into 'main'
Update Persian translation

See merge request GNOME/glib!4552
2025-03-12 09:51:42 +00:00
Thomas Haller
4845314c01 gobject: add internal g_destroy_notify_assert_not_reached() helper
This is a GDestoryNotify that asserts not to be called. Obviously, this
is only for testing and asserting (defensive programming).

It is private API inside "libgobject-2.0.so.0". If unused, we rely that
the linker can strip it out.
2025-03-12 08:27:15 +01:00
Thomas Haller
dec3ba69e8 gobject: avoid potential race and use g_datalist_id_update_atomic() for closure array
There are two calls to

  g_datalist_id_set_data (&object->qdata, quark_closure_array, NULL);

that don't take a OPTIONAL_BIT_LOCK_CLOSURE_ARRAY lock. These are inside
g_object_real_dispose() and right before finalize(). The one before
finalize() is fine, becase we are already in a situation where nobody
else holds a reference on object.

However not so with g_object_real_dispose().  That is called after we
checked that there is only one strong reference left and we are inside
the call to dispose(). However, at that point (before chaining up
g_object_real_dispose()) the callee is able can pass the reference
to another thread. That other thread could create a Closure and destroy it
again. This calles object_remove_closure() (accessing CArray) which now
races against g_object_real_dispose() (destroying CArray).

Granted, this is very unlikely to happen. But let's try to avoid such
races in principle.

We can avoid this problem with less overhead by doing everything while
holding the GData lock, using g_datalist_id_update_atomic().  This is
probably even faster, as we don't need the additional
OPTIONAL_BIT_LOCK_CLOSURE_ARRAY lock.

Also free the empty closure data during object_remove_closure(). This
frees some unused memory.
2025-03-12 08:22:52 +01:00
Philip Withnall
986d1c8d69 Merge branch 'update-danish-translation' into 'main'
Updated Danish translation

See merge request GNOME/glib!4551
2025-03-11 23:26:22 +00:00
Danial Behzadi
688b431db7 Update Persian translation. 2025-03-12 02:37:00 +03:30
Ask Hjorth Larsen
07c5268f64 Updated Danish translation 2025-03-11 16:26:09 +01:00
Michael Catanzaro
444aa3e999 Merge branch 'wip/3v1n0/gobject-atomic-pspec' into 'main'
gobject: Be consistent in using atomic logic to handle the GParamSpecPool

See merge request GNOME/glib!4489
2025-03-11 15:13:53 +00:00
Marco Trevisan (Treviño)
5b0ce18dcd gobject: Add single function to check G_ENABLE_DIAGNOSTIC
It was duplicated, and racing too
2025-03-11 01:07:20 +01:00
Marco Trevisan (Treviño)
fba031c41c gobject: Be consistent in using atomic logic to handle the GParamSpecPool
We init it atomically but then we don't really use it in such way and it
may lead to races at read/write times
2025-03-11 01:07:17 +01:00
Philip Withnall
55a7660f18 Merge branch '3634-git-doc-format' into 'main'
girparser: Ignore new doc:format element in GIR files

Closes #3634

See merge request GNOME/glib!4550
2025-03-10 17:02:42 +00:00
Philip Withnall
aee0664e6f girparser: Ignore new doc:format element in GIR files
As of gobject-introspection 1.83.2, a new `<doc:format name="…"/>`
element is supported (as a child of `<repository>`) in GIR files.

For the moment, this information isn’t needed in libgirepository — but
the GIR parser does have to know about the element in order to not throw
an error claiming it’s invalid.

This is a slightly tweaked version of the code added to
gobject-introspection.git in commit
9544cd6c962fab2c3203898779948309833e2439 by Corentin Noël
<corentin.noel@collabora.com>, reformatted slightly to fit in with
GLib’s style guidelines.

This is backwards compatible and does not require a new
gobject-introspection version.

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

Fixes: #3634
2025-03-10 15:21:15 +00:00
Philip Withnall
09f672e60b Merge branch 'installed-tests-fix' into 'main'
tests: Don't install runner scripts without installed_tests

See merge request GNOME/glib!4544
2025-03-10 12:39:29 +00:00
Marco Trevisan
dc1b097f2d Merge branch '3630-netlink-linux' into 'main'
build: Check for <netlink/netlink_route.h> for GNetworkMonitorNetlink

Closes #3630

See merge request GNOME/glib!4549
2025-03-10 12:24:22 +00:00
Philip Withnall
31546be3f8 build: Check for <netlink/netlink_route.h> for GNetworkMonitorNetlink
Apparently it’s possible for `netlink/netlink.h` to be available on
Linux, when we expected it to only be available on FreeBSD, but for
`netlink/netlink_route.h` to not exist. So add a check for the latter.

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

Fixes: #3630
2025-03-10 12:01:52 +00:00
Philip Withnall
a1bc946964 Merge branch 'update-fr-po' into 'main'
Update French translation

See merge request GNOME/glib!4545
2025-03-10 11:22:42 +00:00
Philip Withnall
87f9d90587 Merge branch 'catalan' into 'main'
Update Catalan translation

See merge request GNOME/glib!4547
2025-03-10 11:07:23 +00:00
Jordi Mas
532ef55df7 Update Catalan translation 2025-03-10 11:07:20 +00:00
Philip Withnall
f756c91a9e Merge branch 'update-tr' into 'main'
Update Turkish translation

See merge request GNOME/glib!4548
2025-03-10 11:06:53 +00:00
Sabri Ünal
9f117d4cfe Update Turkish translation
Translation is reviewed on https://l10n.gnome.org/vertimus/glib/main/po/tr/
2025-03-10 00:43:22 +03:00
Vincent Chatelain
97a861d890 Update French translation 2025-03-08 15:03:32 +00:00
Jan Alexander Steffens (heftig)
e661684c13 tests: Don't install runner scripts without installed_tests
Fixes: 9f18bb6258
2025-03-08 01:55:17 +01:00
Philip Withnall
05da47c2d0 2.84.0
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.84.0
2025-03-06 13:09:13 +00:00
Philip Withnall
b312d0c30d Merge branch 'urbalazs-main-patch-88322' into 'main'
Update Hungarian translation

See merge request GNOME/glib!4543
2025-03-06 02:37:44 +00:00
Balázs Úr
604ce5afd4 Update Hungarian translation 2025-03-06 01:07:00 +00:00
Philip Withnall
30ed00b8e5 Merge branch 'test-fixes' into 'main'
tests: Minor fixes to reference and stream-rw_all tests

See merge request GNOME/glib!4540
2025-03-06 00:13:41 +00:00
Philip Withnall
49328baa83 gsettings: Fix a minor formatting problem in get_child() docs
gi-docgen didn’t nest the `<tt>` tags properly for `@name` inside a
longer backticks span.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-05 17:19:55 +00:00
Philip Withnall
517c5b4eed gsettings: Improve documentation for delay-apply mode
Otherwise it looks a bit like calls to `delay()` and `apply()` need to
be paired, like calls to `g_object_freeze_notify()` and
`g_object_thaw_notify()`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-05 17:19:49 +00:00
Philip Withnall
b1066c6eb1 gsettings: Clarify settings types in docs
Since the docs are saying what type a key must be in the schema to be
able to call that method, it makes sense to give the type in the same
format used in the schema, i.e. a GVariant type string.

Also link to the `GVariantType` documentation so the user can read up on
it further if needed.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-05 17:19:42 +00:00
Philip Withnall
a964d0e7f4 gsettings: 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-03-05 17:19:36 +00:00
Michael Catanzaro
8622f4511c Merge branch 'debug-controller-docs-fix' into 'main'
gdebugcontrollerdbus: Fix a minor typo in a code example in the docs

See merge request GNOME/glib!4542
2025-03-04 19:16:49 +00:00
Philip Withnall
4f2877c502 gdebugcontrollerdbus: Fix a minor typo in a code example in the docs
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-04 16:29:23 +00:00
Philip Withnall
429661491c Merge branch 'translation-ko-202503' into 'main'
Update Korean translation

See merge request GNOME/glib!4539
2025-03-04 14:22:51 +00:00
Philip Withnall
3920e0f172 tests: Fix an incorrect array length in stream-rw_all test
The array was declared one byte too short to contain the trailing nul
byte for the string literal. Spotted by gcc 15.

Fix it by allowing the compiler to work out the array length.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-04 14:20:48 +00:00
Philip Withnall
00ff3c6339 gsettings: Add missing (nullable) annotations to g_settings_bind_with_mapping()
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-04 13:36:59 +00:00
Philip Withnall
4d566e47d7 tests: Skip a hard-to-reproduce race in reference tests under valgrind
Fixes test timeouts like this one:
https://gitlab.gnome.org/GNOME/glib/-/jobs/4827270

The race will continue to be reproduced when running the tests not under
valgrind.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-04 12:43:44 +00:00
Changwoo Ryu
661b45923c Update Korean translation 2025-03-04 21:24:28 +09:00
Philip Withnall
bfe3acd0e6 gsettings: Add a missing (nullable) annotation to GSettingsGetMapping
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-03-03 19:10:58 +00:00