Commit Graph

30723 Commits

Author SHA1 Message Date
Arjan Molenaar
fac8a8c8d8 macos: Add test for async launcher
The test brings a Finder window to the front. It's not ideal,
but I have no better idea at the moment. It would be cool if we
can make the test case register itself as handler for a particular
uri scheme, but I have no idea how to do that.
2024-08-10 19:34:29 +02:00
Arjan Molenaar
edd36a907b macos: simplify urlspec setup for launch_uris_async
NB. Using toll-free bridging to cast NSURL to a CFURLRef
See https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/Toll-FreeBridgin/Toll-FreeBridgin.html
2024-08-10 19:34:29 +02:00
Arjan Molenaar
9f0ff882c1 macos: Fill appUrl directly
No need to convert it to a char* first.
This also avoids threading issues with OsxAppInfo's get_filename() method.
2024-08-10 19:34:29 +02:00
Arjan Molenaar
71e87fc29c more indentation fixes 2024-08-10 19:34:29 +02:00
Arjan Molenaar
e9ee147ac9 macos: fix header indentation 2024-08-10 19:34:29 +02:00
Arjan Molenaar
c67ae98588 macos: Implement GAppInfo.launch_uris_async interface
The implementation is heavily inspired by the Windows implementation.
2024-08-10 19:34:29 +02:00
Michael Catanzaro
c2078021cb Merge branch 'gvariant-copy-free-func' into 'main'
GVariant: Add copy-func and free-func annotations

See merge request GNOME/glib!4161
2024-08-10 13:52:00 +00:00
Michael Catanzaro
d8514c4b8d Merge branch 'th/hash-steal-extended-set' into 'main'
ghash: fix g_hash_table_steal_extended() when requesting key and value of a set

See merge request GNOME/glib!2980
2024-08-09 18:54:15 +00:00
Thomas Haller
f6cf2bcfd2 ghash: fix g_hash_table_steal_extended() when requesting key and value of a set
GHashTable optimizes for the "set" case, where key and value are the same.
See g_hash_table_add().

A user cannot see from outside, whether a GHashTable internally is a set
and shares the keys and values array. Adding one key/value pair with
differing key and value, will expand the GHashTable.

In all other cases, the GHashTable API hides this implementation detail
correctly. Except with g_hash_table_steal_extended(), when stealing both the
key and the value.

Fix that. This bug fix is obviously a change in behavior. In practice,
it's unlikely that somebody would notice, because GHashTable contains
opaque pointers and the user must know what the keys/values are and
be aware of their ownership semantics when stealing them. That means,
the change in behavior only affects instances that are internally a set,
of what the user most likely is aware and fills the table with
g_hash_table_add(). Such a user would not steal both the key and
values at the same time. Even if they do, then previously stealing the
value was pointless and would not give them what they wanted. It would
not have meaningfully worked, and since nobody reported a bug about this
yet, it's unlikely somebody noticed.

The more problematic case when the user exhibits the bug is when the
dictionary is unexpected a set internally. Imagine a mapping from numbers
to numbers (e.g. a permutation). If "unexpectedly" the dictionary contains
the identity permutation, steal-extended gives always NULL for the target
number.

The example is far fetched. In practice, it's unlikely that somebody is
gonna notice either way. That is not an argument for fixing anything.
The argument for fixing this, is that the bug breaks the illusion that
the set is only an internal optimization. That is ugly and inconsistent.
2024-08-09 19:24:08 +02:00
Thomas Haller
600dd1a8a9 ghash/tests: add test cases for g_hash_table_steal_extended() for a set 2024-08-09 19:23:13 +02:00
Michael Catanzaro
f8b230f593 Merge branch 'gbytes-copy-free-func' into 'main'
GBytes: Add copy-func and free-func annotations

See merge request GNOME/glib!4162
2024-08-09 16:08:41 +00:00
Michael Catanzaro
804f6de450 Merge branch 'nielsdg/gmain-gi-docgen' into 'main'
gmain: Adapt to gi-docgen comments

See merge request GNOME/glib!4177
2024-08-09 15:44:32 +00:00
Marco Trevisan
044acfcb77 Merge branch 'wip/chergert/fix-mapped-file-get-contents' into 'main'
glib/mappedfile: g_mapped_file_get_contents() does not transfer

See merge request GNOME/glib!4180
2024-08-09 15:14:03 +00:00
Olivier Blin
dd62ad57d9 gstring: fix unused-result warning with g_string_free() in C++
Some g++ versions issue an unused-result warning for the g_string_free() macro:

error: ignoring return value of 'gchar* g_string_free_and_steal(GString*)',
declared with attribute warn_unused_result [-Werror=unused-result]
    g_string_free(s, TRUE);

This occurs with gcc 6.x / 7.1 / 7.2, and it is fixed in gcc 7.3.
2024-08-07 15:57:20 +02:00
Emmanuele Bassi
c865680f96 Merge branch 'fix-up-gapplication-docs-a-little' into 'main'
docs: Linkify a function

See merge request GNOME/glib!4181
2024-08-05 12:55:32 +00:00
Matthias Clasen
653cdb73d7 docs: Linkify a function
I answered a question on irc about withdrawing notifications, and
when I handed out a link to the GApplication docs, I noticed we
don't have this function name linkified. Fix that.
2024-08-05 08:23:45 -04:00
Christian Hergert
fab6595562 glib/mappedfile: g_mapped_file_get_contents() does not transfer
This fixes the annoations for g_mapped_file_get_contents() which looks
like it might transfer ownership (due to being a char*) but does not as
we're pointing into the mmap() region.
2024-08-02 14:20:36 -07:00
Marco Trevisan
ce5e11aef4 Merge branch 'ebassi/release-2-81-1' into 'main'
2.81.1

See merge request GNOME/glib!4179
2024-08-02 12:57:08 +00:00
Marco Trevisan (Treviño)
6c679fb37a gcancellable: Mark assert-only variable as unused 2024-08-02 13:57:29 +02:00
Marco Trevisan (Treviño)
2f938054e9 ci: Also compile C++ files with coverage collection 2024-08-02 13:57:29 +02:00
Marco Trevisan (Treviño)
24ec28a9a6 tools/glib.supp: Ignore valgrind false-positive error on wcsxfrm
See: https://gitlab.gnome.org/GNOME/glib/-/issues/3292
2024-08-02 13:57:29 +02:00
Marco Trevisan (Treviño)
48ef51f568 ci: Ignore empty lcov files such as the baselines ones 2024-08-02 13:57:29 +02:00
Marco Trevisan (Treviño)
f2993b10df ci/coverage: Fix link of coverage index page
Use $CI_JOB_ID as $CI_BUILD_ID is undefined
2024-08-02 13:57:25 +02:00
Emmanuele Bassi
77da866407 Post-release version bump to 2.81.2 2024-08-02 12:52:54 +01:00
Emmanuele Bassi
95eafc0738 2.81.1
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
2024-08-02 12:41:55 +01:00
Marco Trevisan (Treviño)
0f8971472c ci/coverage: Help genhtml to define the common prefix 2024-08-02 13:26:28 +02:00
Marco Trevisan (Treviño)
447ebe16af ci/coverage: Remove coverage from all subprojects 2024-08-02 13:26:28 +02:00
Marco Trevisan (Treviño)
a04340a742 ci/fixup-cov-paths: Ensure path replacement still works
Without doing this we were replacing the paths with the glib subfolder,
pointing to the wrong files.
2024-08-02 13:26:28 +02:00
Marco Trevisan (Treviño)
05d81f03f6 gtestutils: Use TAP 14 syntax by default
The issue of meson 60 have been resolved for some time now, so we can
just use newer TAP syntax safely.

Revert "gtestutils: Use TAP 13 comments syntax for subtests"
This reverts commit e8725407bcd35c1fa8fed92250edf080d5542b3c.

Closes: #2885
2024-08-02 09:36:53 +02:00
Marco Trevisan (Treviño)
c320bb0bf8 ci: Ignore unused patterns
gnulib doesn't seem to be used at the moment so its _build folder, but let's
still try and don't fail if that's not happening
2024-08-02 03:39:49 +02:00
Marco Trevisan (Treviño)
d6a18eec81 tools/glib.supp: Also ignore possible leaks on g_set_user_dirs()
Newer valgrind is smarter so g_set_user_dirs() are now possible leaks
2024-08-02 03:39:49 +02:00
Marco Trevisan (Treviño)
b2c5092bf1 glib/tests/unix: Free fds before exiting
Old valgrind wasn't spotting this but we're smarter now!
2024-08-02 03:39:48 +02:00
Marco Trevisan (Treviño)
64f7445232 ci: Actually use a fedora 39 image
Also start using a more reliable versioning scheme for the fedora images
so that the tag is always vFEDORA_VERSION.IMAGE_VERSION to make it
easier to understand on future updates

Fixes: #3381
2024-08-02 03:39:48 +02:00
Marco Trevisan (Treviño)
2665a34b3f ci: Update coverage files atomically
Since we run tests in parallel we may end up rewriting the coverage info
while running files acting on the same source files.

The compiler can be smart though, so let's use the proper flag.

Despite this, sometimes we may still end up into negative reports, so
let's ignore them in CI since it's not worth breaking the build because
of these coverage-parsing failures.
2024-08-02 03:39:48 +02:00
Marco Trevisan (Treviño)
2c94349e79 ci: Ignore lcov errors on source missing
When using dtrace some temporary files may be leaked as source files and
this may lead to build issues such as

  geninfo: ERROR: unable to open
    /builds/GNOME/glib/_build/.dtrace-temp.ed1c5ba9.c:
    No such file or directory

AFAIK there's no way to keep these temporary files around, so the only
thing we can do is making lcov less strict about missing files.

We can drop the special option from genhtml since it's using the same
lcovrc file
2024-08-02 03:39:47 +02:00
Niels De Graef
10d4edea2e gmain: Adapt to gi-docgen comments
Now that we've switched to `gi-docgen`, let's make sure our docs are
getting updated. This commit fixes most of the previous gtk-doc
references so that they now follow gi-docgen syntax.

Some exceptions are functions or types that are referenced, but are
generated by a higher level layer like `Gio`, `GObject` or `Gtk`.
2024-08-01 18:38:57 +02:00
Julian Sparber
23b858a3de gappinfo: Pass activation token from launch context to open_uri/file portal
The `activation_token` option was added to the portal in v4, so let's
actually pass a activation token if we have one.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2868
2024-07-29 09:30:09 +02:00
Julian Sparber
6210708f05 gappinfo: Allow giving no GAppInfo for getting startup notify id
On Wayland the activation token returned by
`g_app_launch_context_get_startup_notify_id()` doesn't depend on the
`GAppInfo`. The token is only used to hand over focus to the
application that is launched. In some cases it's not even possible to know
what application will actually be used to open the files. For example
when using portals within a sandbox. Therefore, allow providing no
`GAppInfo`.

This also makes clear in the docs that the `files` argument can be `NULL`.
2024-07-29 09:30:09 +02:00
Julian Sparber
6ee0389f68 gopenuriportal: Rename functions and switch to GFile as argument
We want to add the support for the activation token, to get it we use
`g_app_launch_context_get_startup_notify_id` which takes a list of
files, so that we don't have to create a GFile twice simply change the
signature of the functions. Fortunately this isn't a public API.
2024-07-29 09:30:09 +02:00
Michael Catanzaro
474dbd91f7 Merge branch 'fix-macos-build' into 'main'
meson: Fix project not compiling in macOS

Closes #3419

See merge request GNOME/glib!4175
2024-07-28 16:27:57 +00:00
Roshan-R
c534037e12 meson: Fix project not compiling in macOS
Fixes: #3419
2024-07-28 19:50:30 +05:30
Michael Catanzaro
1e6c6ebaa5 Merge branch 'kqueue-gobject-dep' into 'main'
meson: Fix another kqueue build race on macOS

See merge request GNOME/glib!4174
2024-07-27 19:33:15 +00:00
Nirbheek Chauhan
a4483644e8 meson: Fix another kqueue build race on macOS
`gobject-visibility.h` is also needed at build time. To reproduce the
error, just run `ninja gio/kqueue/libkqueue.a`
2024-07-27 08:03:42 +05:30
Philip Withnall
44a145f2e3 Merge branch 'wip/pwithnall/3399-glib-gir-platform-differences-appinfo-content-types' into 'main'
gappinfo and gcontenttype: Make introspection annotations available on all platforms

See merge request GNOME/glib!4167
2024-07-26 15:51:28 +00:00
Simon McVittie
63690399f2 Merge branch 'wip/smcv/msys2-mingw32-allow-failure' into 'main'
CI: Mark msys2-mingw32 as allowing failures

See merge request GNOME/glib!4173
2024-07-26 15:50:54 +00:00
Simon McVittie
4b1ee1f738 Merge branch 'wip/smcv/bug3418-newlocale-errno' into 'main'
strfuncs: Don't let get_C_locale() clobber errno

Closes #3418

See merge request GNOME/glib!4170
2024-07-26 15:41:26 +00:00
Simon McVittie
16819a4024 CI: Mark msys2-mingw32 as allowing failures
Workaround for GNOME/glib#3420

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-07-26 16:31:36 +01:00
Simon McVittie
e807966b84 strfuncs: Don't let get_C_locale() clobber errno
Some callers of `g_ascii_strtoull()` and similar functions assume that
they can use this pattern, similar to what they might do for
Standard C `strtoull()`:

    errno = 0;
    result = g_ascii_strtoull (nptr, endptr, base);
    saved_errno = errno;

    if (saved_errno != 0)
      g_printerr ("error parsing %s\n", nptr);

This is based on the fact that it is non-trivial to tell whether
`strtoull()` and related functions succeeded (in which case the value
of `errno` is unspecified) or failed (in which case `errno` is valid).
For example, POSIX `strtoul(3)` suggests this pattern:

> Since 0, `ULONG_MAX`, and `ULLONG_MAX` are returned on error and are
> also valid returns on success, an application wishing to check for
> error situations should set `errno` to 0, then call `strtoul()` or
> `strtoull()`, then check `errno`.

However, `g_ascii_strtoull()` does not *only* call a function resembling
`strtoull()` (`strtoull_l()` or its reimplementation
`g_parse_long_long()`): it also calls `get_C_locale()`, which wraps
`newlocale()`. Even if `newlocale()` succeeds (which in practice we
expect and assume that it will), it is valid for it to clobber `errno`.
For example, it might attempt to open a file that only conditionally
exists, which would leave `errno` set to `ENOENT`.

This is difficult to reproduce in practice: I encountered what I
believe to be this bug when compiling GLib-based software for i386 in a
Debian 12 derivative via an Open Build Service instance, but I could
not reproduce the bug in a similar chroot environment locally, and I
also could not reproduce the bug when compiling for x86_64 or for a
Debian 10, 11 or 13 derivative on the same Open Build Service instance.
It also cannot be reproduced via the GTest framework, because
`g_test_init()` indirectly calls `g_ascii_strtoull()`, resulting in
the call to `newlocale()` already having happened by the time we enter
test code.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/3418
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-07-26 13:08:27 +01:00
Emmanuele Bassi
3aee3c4e46 Merge branch 'wip/pwithnall/3415-module-tests' into 'main'
tests: Run GModule tests in subprocesses

Closes #3415

See merge request GNOME/glib!4169
2024-07-24 19:52:57 +00:00
Emmanuele Bassi
055eef3994 Merge branch 'wip/pwithnall/3399-glib-gir-platform-differences-gthread' into 'main'
gthread: Make introspection comments platform-independent

Closes #3399

See merge request GNOME/glib!4168
2024-07-24 19:20:56 +00:00