Commit Graph

27372 Commits

Author SHA1 Message Date
Philip Withnall
715c8064be Merge branch 'meson-system-libintl-detection' into 'main'
meson: Fix detection of a system-provided proxy-libintl

See merge request GNOME/glib!3352
2023-04-14 15:50:20 +00:00
Philip Withnall
088e2a4f5a Merge branch 'socket-nonblock' into 'main'
gsocket/inotify/gwakeup: Use SOCK_NONBLOCK and O_NONBLOCK to avoid fcntl() syscalls where possible

See merge request GNOME/glib!3347
2023-04-14 15:49:52 +00:00
Philip Withnall
17295bd0b0 Merge branch 'move-msvc-recommended-pragmas' into 'main'
meson: Move msvc_recommended_pragmas.h to a subdirectory

See merge request GNOME/glib!3340
2023-04-14 15:49:21 +00:00
Philip Withnall
1ebfe32c06 Merge branch 'gio-tool-info-strings' into 'main'
gio-tool-info: Fix a duplicate attribute name in the UI

See merge request GNOME/glib!3337
2023-04-14 15:48:43 +00:00
Philip Withnall
5611851eb9 Merge branch 'bsd-libelf-enabled' into 'main'
meson: allow -Dlibelf=enabled without pkg-config

See merge request GNOME/glib!3335
2023-04-14 15:48:20 +00:00
Philip Withnall
8a2fbe78d2 Merge branch 'post-release-version-stuff' into 'main'
build: Post-release version bump

See merge request GNOME/glib!3378
2023-04-14 15:46:08 +00:00
Philip Withnall
e993e27782 docs: Add 2.78 release series documentation pages to the build
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-14 16:09:34 +01:00
Philip Withnall
f06bc48685 build: Post-release version bump
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-14 16:09:33 +01:00
Philip Withnall
56bc6bcad2 Merge branch '1264-gdbus-double-unref' into 'main'
gdbusconnection: Fix double unref on timeout/cancel sending a message

Closes #1264

See merge request GNOME/glib!3291
2023-04-14 14:57:32 +00:00
Philip Withnall
0a84c182e2 gdbusconnection: Improve refcount handling of timeout source
The ref on the timeout source owned by `SendMessageData` was being
dropped just after attaching the source to the main context, leaving it
unowned in that struct. That meant the only ref on the source was held
by the `GMainContext` it was attached to.

This ref was dropped when returning `G_SOURCE_REMOVE` from
`send_message_with_reply_timeout_cb()`. Before that happens,
`send_message_data_deliver_error()` is called, which normally calls
`send_message_with_reply_cleanup()` and destroys the source.

However, if `send_message_data_deliver_error()` is called when the
message has already been delivered, calling
`send_message_with_reply_cleanup()` will be skipped. This leaves the
source pointer in `SendMessageData` dangling, which will cause problems
when `g_source_destroy()` is subsequently called on it.

I’m not sure if it’s possible in practice for this situation to occur,
but the code certainly does nothing to prevent it, and it’s easy enough
to avoid by keeping a strong ref on the source in `SendMessageData`.

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

Helps: #1264
2023-04-14 15:37:21 +01:00
Philip Withnall
b84ec21f9c gdbusconnection: Rearrange refcount handling of map_method_serial_to_task
It already implicitly held a strong ref on its `GTask` values, but
didn’t have a free function set so that they would be automatically
unreffed on removal from the map.

This meant that the functions handling removals from the map,
`on_worker_closed()` (via `cancel_method_on_close()`) and
`send_message_with_reply_cleanup()` had to call unref once more than
they would otherwise.

In `send_message_with_reply_cleanup()`, this behaviour depended on
whether it was called with `remove == TRUE`. If not, it was `(transfer
none)` not `(transfer full)`. This led to bugs in its callers.

For example, this led to a direct leak in `cancel_method_on_close()`, as
it needed to remove tasks from `map_method_serial_to_task`, but called
`send_message_with_reply_cleanup(remove = FALSE)` and erroneously didn’t
call unref an additional time.

Try and simplify it all by setting a `GDestroyNotify` on
`map_method_serial_to_task`’s values, and making the refcount handling
of `send_message_with_reply_cleanup()` not be conditional on its
arguments.

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

Helps: #1264
2023-04-14 15:37:21 +01:00
Philip Withnall
08a4387678 gdbusprivate: Use G_SOURCE_REMOVE in a source callback
This is equivalent to the current behaviour, but a little clearer in its
meaning.

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

Helps: #1264
2023-04-14 15:37:21 +01:00
Philip Withnall
d7c813cf5b gdbusprivate: Improve ownership docs for write_message_async()
The ownership transfers in this code are a bit complex, so adding some
extra documentation and `g_steal_pointer()` calls should hopefully help
clarify things.

This doesn’t introduce any functional changes, just code documentation.

Another drive-by improvement in the quest for #1264.

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

Helps: #1264
2023-04-14 15:37:21 +01:00
Philip Withnall
861741ef4b gdbusprivate: Ensure data->task is cleared when it returns
The existing comment in the code was correct that `data` is freed when
the task callback is called, because `data` is also pointed to by the
`user_data` for the task, and that’s freed at the end of the callback.

So the existing code was correct to take a copy of `data->task` before
calling `g_task_return_*()`.

After calling `g_task_return_*()`, the existing code unreffed the task
(which is correct), but then didn’t clear the `data->task` pointer,
leaving `data->task` dangling. That could cause a use-after-free or a
double-unref.

Avoid that risk by explicitly clearing `data->task` before calling
`g_task_return_*()`.

After some testing, it turns out this doesn’t actually fix any bugs, but
it’s still a good robustness improvement.

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

Helps: #1264
2023-04-14 15:36:32 +01:00
Przemyslaw Gorszkowski
b264585f3c gsignal: Support G_SIGNAL_MATCH_ID in g_signal_handlers_block/unblock/disconnect_matched()
Calling g_signal_handlers_block/unblock/disconnect_matched with only G_SIGNAL_MATCH_ID
do not match any handlers and return 0.

Fixes: #2980

Signed-off-by: Przemyslaw Gorszkowski <pgorszkowski@igalia.com>
2023-04-14 15:27:11 +01:00
Marco Trevisan
45300ae6ea Merge branch 'signal-handler-matching-docs' into 'main'
gsignal: Clarify documentation for GSignalMatchType matching

See merge request GNOME/glib!3377
2023-04-14 13:53:49 +00:00
Philip Withnall
2d8e38c00d gsignal: Clarify documentation for GSignalMatchType matching
The use of ‘OR’ in the existing documentation suggests that the matching
is disjunctive, but it’s actually conjunctive. Clarify that in the
documentation and add a test.

Spotted while reviewing
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3376.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-14 13:55:20 +01:00
Emmanuele Bassi
2f828ef2d4 Merge branch '95-markup-docs' into 'main'
docs: Add simple GMarkup parser example

Closes #95

See merge request GNOME/glib!3364
2023-04-13 21:37:41 +00:00
Emmanuele Bassi
b94d0c2168 Merge branch '799-app-info-monitor-docs' into 'main'
gappinfo: Clarify one-shot behaviour of GAppInfoMonitor::changed in docs

Closes #799

See merge request GNOME/glib!3346
2023-04-13 21:37:36 +00:00
Emmanuele Bassi
2af45f9c20 Merge branch 'libicu-tests' into 'main'
unicode: add tests for g_utf8_normalize() and empty strings

See merge request GNOME/glib!3326
2023-04-13 21:35:51 +00:00
Emmanuele Bassi
18ae2a3d4e Merge branch '322-proxy-subclass-example' into 'main'
tests: Finish update of gdbus-example-proxy-subclass to new GDBus API

Closes #322

See merge request GNOME/glib!3332
2023-04-13 21:35:13 +00:00
Emmanuele Bassi
2972cb61f5 Merge branch 'update-unicode-normalisation-tests' into 'main'
tests: Update Unicode normalisation tests from Unicode 15

See merge request GNOME/glib!3351
2023-04-13 21:33:23 +00:00
Emmanuele Bassi
28209912ef Merge branch '2969-date-time-format-docs' into 'main'
gdatetime: Improve Markdown formatting of g_date_time_format() docs

Closes #2969

See merge request GNOME/glib!3362
2023-04-13 21:32:57 +00:00
Philip Withnall
9e83c0e37e Merge branch 'docs-2963' into 'main'
README.win32.md: Update info for G_PLATFORM_WIN32

Closes #2963

See merge request GNOME/glib!3363
2023-04-13 15:27:49 +00:00
Emmanuele Bassi
ee119b4f02 Merge branch '252-classed-docs' into 'main'
gtype: Improve documentation for G_TYPE_IS_CLASSED and interfaces

Closes #252

See merge request GNOME/glib!3374
2023-04-13 14:52:47 +00:00
Philip Withnall
d1eb9c840c tests: Add type flag tests for interfaces
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #252
2023-04-13 15:39:37 +01:00
Philip Withnall
783f1b8640 gtype: Improve documentation for G_TYPE_IS_CLASSED and interfaces
The documentation previously implicitly said in a few places that
interfaces are classed, but reading through the implementation of
`GType`, I don’t think they are. If they were, the registration of the
fundamental `G_TYPE_INTERFACE` in `gobject_init()` would specify
`G_TYPE_FLAG_CLASSED`. It only specifies `G_TYPE_FLAG_DERIVABLE`.

I think this makes sense, because you can’t subclass an interface.
Subclassing is a key property of being classed.

Tweak the `GType` tutorial to remove that implicit statement, and expand
the documentation for `G_TYPE_IS_CLASSED`.

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

Fixes: #252
2023-04-13 15:37:00 +01:00
Philip Withnall
c1e0506d86 gtype: Clarify return value documentation
‘returns TRUE on success’ is misleading for a lot of these macros, as
they are checking whether a type has a certain property. Such a check
could be successful but return `FALSE`, by the normal meaning of the
word ‘success’.

Instead, reword the docs to spell out when `TRUE` will be returned.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-13 13:51:04 +01:00
badcel
a89b72389a
Explicitly mark size parameter as (in)
The generated gir file marks the size parameter as "out" by default. This is wrong in the context of a caller allocated buffer with a given size. Explicitly marking the size parameter as (in) fixes the issue.
2023-04-11 20:44:06 +02:00
Philip Withnall
718b5d5cd3 Merge branch 'gcc-build-fix' into 'main'
gio: Fix multiple definition error with tests

Closes #2966

See merge request GNOME/glib!3368
2023-04-11 11:31:37 +00:00
David King
6651e80d35 docs: Add simple GMarkup parser example
Based on an initial parser by Luc Pionchon. Tweaked to update to the
latest coding standards by Philip Withnall.

Fixes: #95
2023-04-11 12:19:30 +01:00
Philip Withnall
93168d5319 Merge branch 'old-linux-kernel-futex' into 'main'
gthread-posix: fix build against very old Linux headers

Closes #2861

See merge request GNOME/glib!3370
2023-04-11 11:10:28 +00:00
Peter Williams
1219920fcf gthread-posix: fix build against very old Linux headers
See issue GNOME/glib#2861. Even though (hopefully!) few people are
actually running kernels this old, some build frameworks use very old
kernel headers to try to maximize the portability of their binary
artifacts.
2023-04-10 10:36:41 -04:00
Joan Bruguera
d901b55128 tests/file: Do not rely on du --bytes behaviour
As explained in the previous commit, GNU Coreutils 9.2 changes the behaviour
of `du --bytes` to only count regular files and symlinks.

The previous commit makes the test pass with GNU Coreutils >=9.2, but the
machine running the tests may have an older version, or perhaps even a
reimplementation such as uutils. So we can't rely on the size returned by `du`
to be the consistent across systems any more.

However, the plus side of the new behaviour is that the size reported by `du`
/ `G_FILE_MEASURE_APPARENT_SIZE` is now well-defined across filesystems
(as the sum of the sizes of regular files & symlinks), so we can hardcode it.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2965
2023-04-08 00:39:25 +00:00
Joan Bruguera
011fe5ebb2 glocalfile: Sum apparent size only for files and symlinks
Since GNU Coreutils 9.2 (commit 110bcd28386b1f47a4cd876098acb708fdcbbb25),
`du --apparent-size` (including `du --bytes`) no longer counts all kinds of
files (directories, FIFOs, etc.), but only those for which `st_size` in
`struct stat` is defined by POSIX, namely regular files and symlinks
(and also rarely supported memory objects).

This aligns the behaviour of GLib's `G_FILE_MEASURE_APPARENT_SIZE` flag
with the new GNU Coreutils `du` and correct POSIX use.

Note that this may be a breaking change for some uses.

Link: https://lists.gnu.org/archive/html/bug-coreutils/2023-03/msg00007.html
Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2965
2023-04-08 00:39:25 +00:00
Alexander Shopov
6834f225f7 Update Bulgarian translation 2023-04-07 17:12:37 +00:00
Alexander Shopov
3d608960fb Update Bulgarian translation 2023-04-07 16:58:17 +00:00
Dan Yeaw
50851e2706 Fix multiple definition error
Fixes #2966 when compiling with GCC < 9.1 or Clang < 14.0.
2023-04-07 15:22:11 +00:00
Matthias Clasen
e03a96e934 actiongroup: Add a compiler warning
Warn when the boolean return isn't used, since we may not initialize
the out arguments in the FALSE case. Update all internal callers to
use the return value. They were already safe, but users outside GLib
may not be.
2023-04-07 08:44:29 -04:00
Philip Withnall
adcf017eb4 Merge branch 'gwin32-avoid-g-return-macro' into 'main'
gwin32: Avoid use of function call with side effect in g_return_* macro

See merge request GNOME/glib!3365
2023-04-06 13:51:38 +00:00
Kleis Auke Wolthuizen
86ef92d548 gwin32: Avoid use of function call with side effect in g_return_* macro
This ensures that _g_win32_call_rtl_version is always called,
regardless of whether G_DISABLE_CHECKS is defined or not.
2023-04-06 15:19:35 +02:00
Chun-wei Fan
553d82c793 README.win32.md: Update info for G_PLATFORM_WIN32
Correct the info on G_PLATFORM_WIN32, now that we only define it when
GLib is built for native Windows, not Cygwin.  Make it clear that it
should not be used to check for conditional compilation for Cygwin
builds of GLib.
2023-04-06 15:40:07 +08:00
Philip Withnall
ca98d60d6d gdatetime: Improve Markdown formatting of g_date_time_format() docs
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2969
2023-04-05 17:53:41 +01:00
Marco Trevisan
9ec6695a72 Merge branch 'drop-gitignore' into 'main'
build: Drop old .gitignore files from test directories

See merge request GNOME/glib!3333
2023-04-05 14:29:13 +00:00
Marco Trevisan
66d9ab7808 Merge branch '2952-pollable-docs' into 'main'
gpollable: Clarify that can_poll() must be called before other methods

Closes #2952

See merge request GNOME/glib!3348
2023-04-05 14:27:07 +00:00
Marco Trevisan
218daa079e Merge branch '2960-debug-controller-docs' into 'main'
gdebugcontrollerdbus: Fix incorrect paragraph on auth in documentation

Closes #2960

See merge request GNOME/glib!3354
2023-04-05 14:24:50 +00:00
Marco Trevisan
34dc240322 Merge branch '2864-gvalue-docs' into 'main'
gvalue: Fix a typo in a function name in an example in the docs

Closes #2864

See merge request GNOME/glib!3349
2023-04-05 14:17:48 +00:00
Marco Trevisan
913f206b30 Merge branch 'make_clang_happier' into 'main'
Make clang++ happier when using G_STATIC_ASSERT

See merge request GNOME/glib!3357
2023-04-05 14:16:06 +00:00
Philip Withnall
a6f31f3ede Merge branch 'fix-issue-2972' into 'main'
GWin32AppInfo: Fix g_str_has_prefix() check

Closes #2972

See merge request GNOME/glib!3359
2023-04-05 14:09:53 +00:00
Luca Bacci
65e2413dd5 GWin32AppInfo: Fix g_str_has_prefix() check
Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2972
2023-04-05 13:50:23 +02:00