Commit Graph

30556 Commits

Author SHA1 Message Date
Marco Trevisan
7855fc9fb6 Merge branch 'atomic-gcancellable' into 'main'
GCancellable: Use per-instance mutex logic instead of global critical sections

Closes #2309, #2313 e #774

See merge request GNOME/glib!2765
2024-07-24 07:29:19 +00:00
Marco Trevisan (Treviño)
54d9c26b34 gcancellable: Reference the object before locking when doing signal emission
On g_cancellable_cancel() we were increasing the GCancellable ref count
before emitting the ::cancelled signal, this is a safe thing to do but
it was happening while the cancellable was locked, and this may have
potentially waken up some toggle notifications.

To prevent this, reference the GCancellable just before locking.
2024-07-24 00:21:35 +02:00
Marco Trevisan (Treviño)
3a07b2abd4 GCancellable: Use per-instance mutex logic instead of global critical sections
GCancellable is meant to be used in multi-thread operations but all the
cancellable instances were sharing a single mutex to synchronize them
which can be less optimal when many instances are in place.
Especially when we're doing a lock/unlock dances that may leave another
thread to take the control of a critical section in an unexpected way.

This in fact was leading to some races in GCancellableSources causing
leaks because we were assuming that the "cancelled" callback was always
called before our dispose implementation.

As per this, use per-instance mutexes.

The lock is also now used only to protect the calls that may interact
with cancelled state or that depends on that, as per this we can just
reduce it to the cancel and reset case, other than to the connect one to
prevent the race that we could have when connecting to a cancellable
that is reset from another thread.

We don't really need to release the locks during callbacks now as they
are per instance, and there's really no function that we allowed to call
during a ::cancelled signal callback that may require an unlocked state.
This could been done in case with a recursive lock, that is easy enough
to implement but not really needed for this case.

Fixes: #2309, #2313
2024-07-24 00:21:35 +02:00
Marco Trevisan (Treviño)
0a8cb10f22 gio/tests: Ensure that a GCancellableSource can be used muliple times
Closes: #774
2024-07-24 00:21:35 +02:00
Philip Withnall
732b0f1204 Merge branch 'wip/g-static-assert-gi-scanner' into 'main'
gmacros: Define G_STATIC_ASSERT for GI Scanner

See merge request GNOME/glib!4166
2024-07-23 13:39:00 +00:00
Sebastian Wick
363f5ebafc gmacros: Define G_STATIC_ASSERT for GI Scanner
Using G_STATIC_ASSERT in headers which are introspected currently
requires guarding them behind `#ifndef __GI_SCANNER__` which is really
annoying. We can just define the macros to be noops in a way that the
scanner doesn't trip over them.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-07-23 12:25:35 +02:00
Sebastian Wick
88da3a718d gmacros: Define G_PASTE/G_PASTE_ARGS for GI Scanner
They are guarded for the GI Scanner right now even though they should be
fine to expose and they are used in macros that are not guarded for the
GI Scanner.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-07-23 12:19:32 +02:00
Michael Catanzaro
d5f0f2e23e Merge branch 'g-gnuc-unused-docs' into 'main'
docs: Clarify that G_GNUC_UNUSED can’t be used on definitions

See merge request GNOME/glib!4164
2024-07-21 01:34:17 +00:00
Philip Withnall
0b8f69b28a
docs: Clarify that G_GNUC_UNUSED can’t be used on definitions
Only on declarations.

This has now bitten me multiple times.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-07-20 19:11:13 +02:00
Philip Withnall
d5c088e730 Merge branch 'wip/oholy/x-gvfs-trash' into 'main'
gfile: Add support for x-gvfs-trash mount option

See merge request GNOME/glib!4155
2024-07-20 10:00:02 +00:00
Philip Withnall
107b47226c Merge branch 'introspection-correct-gio-windows-pkg' into 'main'
introspection: Correct GIO-Windows pkg-config name

See merge request GNOME/glib!4159
2024-07-18 08:30:41 +00:00
Chun-wei Fan
297d808c6b introspection: Correct GIO-Windows pkg-config name
It's gio-windows-2.0.pc, not gio-win32-2.0.pc.

Otherwise, we get warnings/errors where the package cannot be located
but since we are linking to the same GIO library file, this did not
manifest itself.
2024-07-17 16:28:34 +08:00
Ondrej Holy
d9fec76b59 gfile: Add support for x-gvfs-trash mount option
Currently, the trash functionality is disabled for system internal mounts.
That might be a problem in some cases. The `x-gvfs-notrash` mount option
allows disabling the trash functionality for certain mounts. Let's add
support for the `x-gvfs-trash` mount option to allow the opposite.

See: https://issues.redhat.com/browse/RHEL-46828
2024-07-16 07:52:00 +02:00
Philip Withnall
d3cb9d638d Merge branch 'traverse-diagrams' into 'main'
docs(GNode): Traversal diagrams, color & dark-mode

See merge request GNOME/glib!4157
2024-07-15 15:58:45 +00:00
Philip Withnall
a931a75c4f docs(GNode): Traversal diagrams, color & dark-mode
* Create a dark-mode variant of each traversal diagram, with the
  traversal path colorized `--primary` blue, instead of the original
  black.
* Apply the same colorizations to the light-mode diagrams, but
  using the light-theme `--primary` blue.
* Add SPDX license/copyright comments to all eight SVG files.
* Add new files to documentation configs in `glib.toml.in`.
* Update documentation comment in `gnode.c` to embed both color
  variants via picture tags, instead of markdown image embeds.
* Add alt text to all four images.
* Add additional blank lines to documentation comment, so that
  a. First item in bulleted list does not get folded into
     preceding intro paragraph
  b. Intro paragraph and diagrams are not part of first paragraph
     in documentation. (This also gets them out of the top-level
     table-of-contents/index list, where they previously appeared
     in full.)
* (Accidental change I didn't realize I was making): Convert line
  endings in breadth-first diagram from CRLF to LF.
2024-07-15 15:58:45 +00:00
Philip Withnall
79c57b5b80 Merge branch 'gbsneto/doc-fixes-pt1' into 'main'
Port some GIO files to gi-docgen

See merge request GNOME/glib!4113
2024-07-11 21:01:39 +00:00
Georges Basile Stavracas Neto
a84c67da71 gio/appinfo: Directly link GdkAppLaunchContext
We can only use the [class@Foo.Bar] syntax for identifiers under
namespaces included by the current namespace. Naturally, we cannot
include the GDK namespace.

Use a direct link for this instead.
2024-07-11 16:23:06 +01:00
Georges Basile Stavracas Neto
ecc9904996 gio/applaunchcontext: Port docs to gi-docgen
This one is a little more self-contained, even though the class name
doesn't match the file it is in.
2024-07-11 15:33:41 +01:00
Georges Basile Stavracas Neto
b8db83940b gio/appinfo: Port docs to gi-docgen
Adjust all docs to use the gi-docgen referencing syntax, reindent
some of the comments, and add missing annotations to some async
methods.

The error arguments are not necessary with gi-docgen so they're
removed.

Confusingly enough, the docks for GAppInfo is spread between two
files.
2024-07-11 15:33:41 +01:00
Georges Basile Stavracas Neto
110e76a140 gio/actionmap: Port docs to gi-docgen 2024-07-11 15:33:41 +01:00
Georges Basile Stavracas Neto
3bd477b454 gio/actiongroupexporter: Port docs to gi-docgen 2024-07-11 15:33:41 +01:00
Philip Withnall
1b7336583c Merge branch 'darwin-rtld_local-fix' into 'main'
gmodule-dl: fix G_MODULE_BIND_LOCAL on Darwin

See merge request GNOME/glib!4154
2024-07-11 14:11:19 +00:00
Randy Eckenrode
3ab13ddc4b
gmodule: skip local-binding test on Windows 2024-07-11 00:47:42 -04:00
Randy Eckenrode
73d913519d
gmodule-dl: fix G_MODULE_BIND_LOCAL on Darwin
According to POSIX, the default behavior of `dlopen` is unspecified when
its flags include neither `RTLD_LOCAL` nor `RTLD_GLOBAL`. Consequently,
different platforms have different default behavior.

The default on Linux is `RTLD_LOCAL`, but the default on Darwin is
`RTLD_GLOBAL`. By passing `0` to `dlopen`, this results in the opposite
of the caller's intent when using `G_MODULE_BIND_LOCAL`.

Passing `RTLD_LOCAL` for `G_MODULE_BIND_LOCAL` allows the correct
behavior to be observed regardless of the platform's default.
2024-07-10 20:00:22 -04:00
Michael Catanzaro
4a73fbda8b Merge branch 'wip/pwithnall/resolver-parsing-bsd-fix' into 'main'
tests: Fix compilation of resolver-parsing test on FreeBSD

See merge request GNOME/glib!4152
2024-07-09 23:07:02 +00:00
Philip Withnall
fd2295c545 Merge branch 'port-gfilteroutputstream.c-comments' into 'main'
gfilteroutputstream.c: Port all doc comments to gi-docgen

See merge request GNOME/glib!4145
2024-07-09 22:54:47 +00:00
Philip Withnall
8bf5873272 Merge branch 'bilelmoussaoui-main-patch-13638' into 'main'
gi: Add missing Since annotation

See merge request GNOME/glib!4144
2024-07-09 22:08:49 +00:00
Philip Withnall
dfe6d0f8ce Merge branch 'ebassi/docs-location' into 'main'
docs: Add source location URL

See merge request GNOME/glib!4142
2024-07-09 21:06:02 +00:00
Philip Withnall
929f2ae06b
tests: Fix compilation of resolver-parsing test on FreeBSD
This fixes commit cdcb179808.

`dn_comp()` is needed to build fake DNS records for most of the tests in
this file. The new ownership test is no exception.

See https://gitlab.gnome.org/GNOME/glib/-/jobs/4058481

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-07-09 21:41:03 +01:00
Philip Withnall
ef57fa8a29 Merge branch 'port-gbufferedinputstream.c-comments' into 'main'
gbufferedinputstream: Port all doc comments to gi-docgen

See merge request GNOME/glib!4146
2024-07-09 19:36:55 +00:00
Philip Withnall
a7da10fea8 Merge branch 'asan-cygwin-build-fix' into 'main'
glib-private: fix build under Cygwin

See merge request GNOME/glib!4150
2024-07-09 19:25:31 +00:00
Emmanuele Bassi
a807604ef6 docs: Add source location URL
If the base URL for source location is set, gi-docgen will automatically
generate a link to the location of declarations and doc blocks in the
source.
2024-07-09 20:17:09 +01:00
Bilal Elmoussaoui
a31479316d gi: Add missing Since annotation
Fixes b32e1b63ee
2024-07-09 20:16:20 +01:00
Philip Withnall
fc01879341 Merge branch 'wip/pwithnall/macos-ci-fix' into 'main'
tests: Make an error check less specific in gsocketclient-slow

See merge request GNOME/glib!4149
2024-07-09 19:13:26 +00:00
Christoph Reiter
a49815926c glib-private: fix build under Cygwin
fb58d55187 added weak linking for ASAN,
skipping it for MinGW because weak symbols are broken there.
The same is true for Cygwin, so skip things there too.

This fixes the following build error under MSYS2:

/usr/lib/gcc/x86_64-pc-msys/13.3.0/../../../../x86_64-pc-msys/bin/ld:
    glib/msys-glib-2.0-0.dll.p/gutils.c.o:gutils.c:
        (.rdata$.refptr.__lsan_enable[.refptr.__lsan_enable]+0x0): undefined reference to `__lsan_enable'
2024-07-09 20:34:02 +02:00
Sudhanshu Tiwari
2e7e51be56 gbufferedinputstream: Port all doc comments to gi-docgen 2024-07-09 18:21:42 +01:00
Philip Withnall
325a9af5e0 Merge branch 'port-gbufferedoutputstream.c-comments' into 'main'
gbufferedoutputstream.c: Port doc comments to gi-docgen

See merge request GNOME/glib!4148
2024-07-09 17:01:46 +00:00
Philip Withnall
8d0bf4ed39
tests: Make an error check less specific in gsocketclient-slow
On Linux the error will be `G_IO_ERROR_CONNECTION_REFUSED`, but on macOS
it will be `G_IO_ERROR_TIMED_OUT`. Both errors seem reasonable to me, so
let’s not specifically require one of them.

See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4104#note_2161451

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-07-09 17:40:16 +01:00
Sudhanshu Tiwari
c48fd73189 gbufferedoutputstream.c: Port doc comments to gi-docgen 2024-07-09 18:03:03 +05:30
Sudhanshu Tiwari
a8b52cd9d6 gfilteroutputstream.c: Port all doc comments to gi-docgen 2024-07-09 17:30:32 +05:30
Philip Withnall
de71e95041 Merge branch 'wip/leoziyou/macos-network-monitor' into 'main'
GOsxNetworkMonitor: Add network monitor backend for OS X

Closes #1326

See merge request GNOME/glib!3744
2024-07-07 19:36:48 +00:00
Leo Assini
202d345a82 GOsxNetworkMonitor: Add network monitor backend for OS X 2024-07-07 19:36:48 +00:00
Emmanuele Bassi
fc72d920cd Merge branch 'packaging-version' into 'main'
codegen: Drop unused import

See merge request GNOME/glib!4143
2024-07-07 14:09:42 +00:00
Philip Withnall
3993d8db52
codegen: Drop unused import
This should have been dropped in commit
38faeca62e but somehow that didn’t happen
and somehow it wasn’t caught by the CI until afterwards.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/jobs/4049254

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-07-07 13:48:46 +01:00
Philip Withnall
8320085557 Merge branch 'andyholmes/resolver-ownership' into 'main'
gthreadedresolver: ref-sink returned records in lookup_records()

Closes #3393

See merge request GNOME/glib!4110
2024-07-05 06:26:51 +00:00
Andy Holmes
cdcb179808
tests: ensure DNS records are full-reference variants
For each test expected to return valid DNS records, test that the
record variants are not floating references.

Also add an test which checks this explicitly for a simple TXT record.
2024-07-04 17:37:44 -07:00
Philip Withnall
7878938e9a Merge branch 'pr/fix_some_windows_testsuite_failures' into 'main'
tests: fix some Windows testsuite failures

Closes #3370

See merge request GNOME/glib!4125
2024-07-04 19:35:47 +00:00
Benoit Pierre
caf7f8ef49 tests: fix some Windows testsuite failures
Add test dependencies on the 2 spawn helpers required on Windows.
2024-07-04 19:35:47 +00:00
Andy Holmes
da3510575e
gthreadedresolver: ref-sink returned records in lookup_records()
The return value to `lookup_records()` methods is set as `transfer full`
but the code path in `g_resolver_records_from_res_query()` doesn't
sink the GVariant.

Add the `g_variant_ref_sink()` call when prepending the record, so
the list hold a full reference on each records.

closes #3393
2024-07-04 12:06:12 -07:00
Philip Withnall
b29f249544 Merge branch 'async_queue_copy_free_func' into 'main'
GAsyncQueue: Add copy-func and free-func annotations

See merge request GNOME/glib!4131
2024-07-04 13:11:31 +00:00