Commit Graph

7723 Commits

Author SHA1 Message Date
Marco Trevisan
7b53edbf26 Merge branch 'local-output-stream-prevent-double-fd-close' into 'main'
glocalfileoutputstream: Do not double-close an fd on unlink error

See merge request GNOME/glib!2901
2022-09-20 13:19:04 +00:00
Marco Trevisan
51cf76ebb0 Merge branch 'kjellahl/gio-launch-desktop-clang' into 'main'
gio-launch-desktop: Fix the G_STATIC_ASSERT expressions for clang

Closes #2740

See merge request GNOME/glib!2898
2022-09-19 15:04:21 +00:00
Marco Trevisan
65abaa76c5 Merge branch 'task_get_cancellable_nullable' into 'main'
gio: make g_task_get_cancellable return value (nullable)

See merge request GNOME/glib!2899
2022-09-19 15:02:39 +00:00
Marco Trevisan
22f0522c10 Merge branch 'mcatanzaro/gtype-criticals' into 'main'
Replace most GObject warnings with criticals

See merge request GNOME/glib!2852
2022-09-19 14:35:12 +00:00
Marco Trevisan (Treviño)
2401e1a090 glocalfileoutputstream: Do not double-close an fd on unlink error
In case we fail unlinking a file we could close again an FD that has
been already just closed. So avoid this by unsetting it when closing.

Coverity CID: #1474462
2022-09-16 15:11:47 +02:00
Jason Francis
9cd9787c52
gio: make g_task_get_cancellable return value nullable 2022-09-16 01:27:12 -04:00
Kjell Ahlstedt
37dba1c425 gio-launch-desktop: Fix the G_STATIC_ASSERT expressions for clang
The clang compiler requires the static_assert expression to be an integral
constant expression. `"text"` is not, but `sizeof "text"` is.

Fixes #2740
2022-09-15 12:55:18 +02:00
Xavier Claessens
a1c78d63ef meson: Set install_tag on all tools
Those tools are not needed at runtime for typical applications,
distributions typically package them separately.

This makes `meson install --tag runtime` skip installation of those
tools. Omitting `--tag` argument will still install them, as well as
with `--tag bin,bin-devel`.

See https://mesonbuild.com/Installing.html#installation-tags.
2022-09-12 09:50:31 -04:00
Luca Bacci
24572c93c2 Merge branch 'g-win32-app-info-fixes' into 'main'
GWin32AppInfo: Add missing g_spawn_close_pid

See merge request GNOME/glib!2881
2022-09-08 14:12:05 +00:00
Emmanuele Bassi
07a08d5cf5 Merge branch 'coverity-build-fix' into 'main'
gioenumtypes: Only define GLIB_DISABLE_DEPRECATION_WARNINGS if needed

See merge request GNOME/glib!2879
2022-09-07 14:07:45 +00:00
Marco Trevisan (Treviño)
07c808ad90 gioenumtypes: Only define GLIB_DISABLE_DEPRECATION_WARNINGS if needed 2022-09-07 15:31:38 +02:00
Matthias Clasen
1f4188f0ab Merge branch 'fgets-error-ignore' into 'main'
gio-tool-mount: Return early on fgets EOF

Closes #2737

See merge request GNOME/glib!2870
2022-09-06 17:22:15 +00:00
Andy Holmes
1eb1a47a50
GActionGroup: Fix ownership transfer annotation for query_action()
The `(transfer none)` behaviour for `parameter_type` and `state_type`
parameters is implicit with the `const` attribute, but was incorrectly
determined to be `(transfer full)` in the GIR.

Add explicit `(transfer none)` annotations for these two parameters.
2022-09-04 17:29:39 -07:00
Emmanuele Bassi
bafd025811 Merge branch 'ebassi/gcc-12-fixes' into 'main'
Fix array-bounds compiler warnings with GCC 12

See merge request GNOME/glib!2873
2022-09-02 23:17:25 +00:00
Marco Trevisan (Treviño)
221f22b6e1 gdesktopappinfo: Unref the GDBus call results
On our GDBus call callback wrapper we were completing the gdbus call but
ignoring the returned value, that was always leaked.

Fix this.

Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333
2022-09-02 21:21:34 +02:00
Marco Trevisan (Treviño)
026a69905e gdesktopappinfo: Unref GDBus call result GVariant if no callback is set
When launching URIs via dbus we may ignore the callback if one was not
provided, however in such case we were also leaking the return value for
the gdbus call.

Unref it properly.

Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333
2022-09-02 21:21:34 +02:00
Marco Trevisan (Treviño)
e268ff39b6 gio/tests/gdbus-peer: Unref cached property GVariant value
Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333
2022-09-02 21:21:34 +02:00
Marco Trevisan (Treviño)
1da208cddc gio/tests/gdbus-proxy-threads: Unref GVariant's that we own
This test is leaking various GVariant's that we are supposed to unref,
leading the valgrind CI job to complain about.

Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333
2022-09-02 20:26:06 +02:00
Marco Trevisan
88d4b3b365 Merge branch 'fix-doc-portal-add-leak' into 'main'
documentportal: Fix small leak in add_documents with empty URI list

Closes #2733

See merge request GNOME/glib!2871
2022-09-02 18:24:48 +00:00
Sebastian Keller
27203e48c9 documentportal: Fix small leak in add_documents with empty URI list
When called with an empty URI list (or only inaccessible files),
g_document_portal_add_documents would not call g_variant_builder_end,
leaking the memory allocated by the variant builder.

Closes: https://gitlab.gnome.org/GNOME/glib/-/issues/2733
2022-09-02 19:48:36 +02:00
Marco Trevisan (Treviño)
511627b735 tests/dbus-appinfo: Add test case for flatpak opening an invalid file
We were testing the case in which we were opening an actual file, and so
potentially using a fd-list, however we were missing the case in which a file
was not existent.

And in such case we are incidentally hitting a leak now.
2022-09-02 19:48:36 +02:00
Emmanuele Bassi
e08c954693 Fix check before a memcpy
The search_total_results address is always going to be non-zero, so the
check will always evaluate to true, and GCC is kind enough to point this
out to us.

The appropriate fix is checking if the size of the search results array
is larger than zero, and if so, copy them into the total results array.
2022-09-02 12:59:22 +01:00
Luca Bacci
e112bdb247 GWin32AppInfo: Add missing g_spawn_close_pid 2022-09-02 12:35:17 +02:00
Marco Trevisan
2ef66ba386 Merge branch 'main' into 'main'
gio-launch-desktop: replace static_assert with G_STATIC_ASSERT

Closes #2713

See merge request GNOME/glib!2858
2022-08-31 15:06:27 +00:00
Marco Trevisan (Treviño)
a0e71ff86f gio-tool-mount: Return early on fgets EOF
As per commit a5390002 we're exiting with error in case fgets failed,
however it could also fail because of EOF (like on ^D), so in such case
we can just return early treating it as a non-error.

Otherwise still exit with error.

Fixes: #2737
2022-08-30 16:33:29 +02:00
Matthias Clasen
56236d708f Merge branch 'use-cloexec-epoll' into 'main'
gio-unix: Use EPOLL_CLOEXEC by default

See merge request GNOME/glib!2868
2022-08-27 16:37:11 +00:00
Luca Bacci
e1e9bc9429 Merge branch 'g-win32-app-info-launch-uris-async' into 'main'
GWin32AppInfo: Implement launch_uris_async

Closes gtk#4400

See merge request GNOME/glib!2760
2022-08-27 14:11:10 +00:00
Luca Bacci
53515197df GWin32AppInfo: Instantiate ApplicationActivationManager out-of-process
This is recommended on MSDN
2022-08-26 11:33:22 +02:00
Luca Bacci
d12cf95836 GDesktopAppInfo: Tidy up code a bit
* Remove an unneeded field from LaunchUrisData and add annotations
* Rename local GError* variables to local_error
* Use g_set_object
* Fix indentation
2022-08-26 11:33:22 +02:00
Luca Bacci
361b4a8fc9 GAppInfo: Clarify that GAppInfo launch methods can spawn multiple instances
...of the application if many URI's are provided. This is important to note
because the GAppLaunchContext signals may be emitted multiple times during
a single launch operation.
2022-08-26 11:33:22 +02:00
Luca Bacci
42a76e1631 GWin32AppInfo: Check for task cancellation
We cannot cancel a spawn operation, but sometimes we have to
spawn the target application mutiple times (e.g. in case the
target app only supports one URI in its command-line, but we
were given multiple URI's), in that case continuously check
the cancellation status before attempting any spawn operation
2022-08-26 11:33:22 +02:00
Luca Bacci
cff3e660c1 GWin32AppInfo: Emit GAppLaunchContext signals for all code paths 2022-08-26 11:33:09 +02:00
Colin Walters
426fab1eca gio-unix: Use EPOLL_CLOEXEC by default
First, there's no reason not to use the new `epoll_create1` system call,
which quickly obsoleted `epoll_create` which has an obsolete and
unused size argument.

But more specifically, it offers `EPOLL_CLOEXEC` which we want
to use for general hygeine - there's no reason to potentially
leak this file descriptor to forked processes.

(GLib itself carefully closes file descriptors when forking child
 processes, but it may be linked with other software that doesn't;
 notably in my case for example the Rust standard library does not
 do this and hence relies more on the application code using
 `O_CLOEXEC` and variants)

This is just a drive-by fix; I saw the system call when I was using
`strace` to debug something else in rpm-ostree.
2022-08-26 04:10:22 -04:00
Luca Bacci
f0ff6a6af0 GWin32AppInfo: Add g_win32_app_info_launch_uris_impl utility function
This utility function will be called by both launch_uris and
launch_uris_async, passing a from_task parameter respectively
as NULL and non-NULL. The from_task parameter will be needed
to know whether GAppLaunchContext signals should be emitted
directly (from_task == NULL) or scheduled for emission on the
main thread (from_task != NULL).
2022-08-16 12:29:18 +02:00
Marco Trevisan
813ce7f0b5 gio-launch-desktop: preserve static_assert message 2022-08-15 17:02:06 +00:00
Owen Rafferty
c850a06ea2
gio-launch-desktop: replace static_assert with G_STATIC_ASSERT 2022-08-15 01:41:50 -05:00
Luca Bacci
bf13a5e0a4 GWin32AppInfo: Implement launch_uris_async
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4400
2022-08-12 18:33:20 +02:00
Michael Catanzaro
0ffe86a1f7 Replace most GObject warnings with criticals
All of these warnings indicate programmer error, so critical is most
appropriate here.

Exceptions: deprecation warnings are just warnings. Also, warnings that
are worded with uncertainty can remain warnings rather than criticals.
2022-08-09 13:18:47 -05:00
Marco Trevisan (Treviño)
bcddc56c41 gtlscertificate: Update reference to G_TLS_CERTIFICATE_NO_FLAGS
G_TLS_CERTIFICATE_FLAGS_NONE was removed as part of commit aa65fc2537.
2022-08-06 01:33:15 +02:00
Marco Trevisan
a4f60709d5 Merge branch 'mcatanzaro/tls-exporter' into 'main'
Expose tls-exporter channel binding

See merge request GNOME/glib!2853
2022-08-05 22:01:37 +00:00
Michael Catanzaro
9d37075a00 Expose tls-exporter channel binding
Required for glib-networking#191
2022-08-05 16:02:09 -05:00
Marco Trevisan
6965f6457e Merge branch 'iss2588' into 'main'
gio-tool: -d option to delete attribute

Closes #2588

See merge request GNOME/glib!2845
2022-08-05 19:21:58 +00:00
Luca Bacci
d3ae4cc809 GWin32AppInfo: Ensure COM is initialized when activating UWP apps
Using the Application Activation Manager coclass. Its threading model
is marked as 'both', so it can be instantiated in any apartment type
without marshaling.
2022-08-04 21:35:08 +02:00
Luca Bacci
cdb8e5e9c5 Fix warnings in GCancellable test 2022-08-03 20:38:59 +02:00
Luca Bacci
a1737ece06 Fix GCancellable tests for Windows 64bit
Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2703
2022-08-03 20:33:46 +02:00
Luca Bacci
0cb43a4965 Merge branch 'g-win32-app-info-launched-signal-actually-report-pid' into 'main'
GWin32AppInfo: Fix PID reporting in launched signal

See merge request GNOME/glib!2299
2022-08-02 14:51:26 +00:00
Luca Bacci
45bdeeddff GWin32AppInfo: Actually report the GPid in the GAppLaunchContext::launched signal
We need to pass the G_SPAWN_DO_NOT_REAP_CHILD flag to g_spawn_async,
otherwise the returned child_pid will always be 0.
2022-08-02 16:38:32 +02:00
codeboybebop
ece66f11fc gio-tool: -d option to delete attribute
gio tool has support for deleting attributes of the file. To delete attribute user
should specify type '--type="unset"'. This is not mentioned in help and therefore not
intuitive. By adding '-d' option, we make this process more obvious.

closes #2588
2022-07-31 13:19:50 -05:00
Emmanuele Bassi
a9394bd68e Implement GFileIface.set_display_name() for resource files
Resource files cannot be renamed, and GFileIface.set_display_name() is
mandatory.

Fixes: #2705
2022-07-30 20:06:07 +01:00
madmurphy
b295c53769 gfileinfo: Implement xattr attribute removal
Fixes: #1187
2022-07-26 07:58:32 +00:00