Commit Graph

27001 Commits

Author SHA1 Message Date
Dan Carpenter
774d8bd914 Fix a memory leak in g_strerror
If g_locale_to_utf8 sets a GError, it must be freed.
2023-03-02 15:46:00 +01:00
Simon McVittie
6c22a5ee2b Merge branch '2925-gdbus-threading-test' into 'main'
gdbusconnection: Explicitly destroy an idle source on cleanup

See merge request GNOME/glib!3296
2023-03-02 12:35:21 +00:00
Balázs Úr
e429113878 Update Hungarian translation 2023-03-02 01:39:18 +00:00
Matej Urbančič
f96795b302 Update Slovenian translation 2023-02-27 20:23:04 +00:00
Alan Mortensen
43a7435c9c Update Danish translation 2023-02-26 10:52:38 +00:00
Asier Sarasua Garmendia
c98d65c8c9 Update Basque translation 2023-02-26 07:19:59 +00:00
Philip Withnall
ed6db32677 Merge branch 'fix-g-value-annotations' into 'main'
GObject: Add nullable annotations

See merge request GNOME/glib!3301
2023-02-24 17:37:46 +00:00
badcel
1c15f158b0
gobject: Fix some annotations 2023-02-24 18:06:14 +01:00
Philip Withnall
d1415f857e Merge branch 'ebassi/news-update' into 'main'
Update the NEWS file

See merge request GNOME/glib!3299
2023-02-23 15:16:21 +00:00
Philip Withnall
35c9ab144e Merge branch 'main' into 'main'
gio/tests/cxx.cpp: fix missing sentinel for musl

See merge request GNOME/glib!3294
2023-02-23 14:53:20 +00:00
Emmanuele Bassi
4d2e3e6330 Update the NEWS file
The "emit a critical warning if your object notifies a property during
finalization" entry should have been added in 2.75.1, but better late
than never.
2023-02-23 14:18:25 +00:00
Markus Volk
caab1a41dc gio/tests/cxx.cpp: fix missing sentinel for musl
This fixes:
| ../glib-2.75.3/gio/tests/cxx.cpp: In function 'int main(int, char**)':
| ../glib-2.75.3/gio/tests/cxx.cpp:61:15: error: missing sentinel in function call [-Werror=format=]
|    61 |   g_test_init (&argc, &argv, NULL);

if built with musl libc

Signed-off-by: Markus Volk <f_l_k@t-online.de>
2023-02-23 15:02:26 +01:00
Philip Withnall
49467e3453 Merge branch 'onceinit-joins' into 'main'
tests: Add some missing g_thread_join() calls to onceinit test

See merge request GNOME/glib!3295
2023-02-23 13:05:16 +00:00
Simon McVittie
e5941a3af1 Merge branch '2924-use-after-free-gdbus-method-invocation' into 'main'
gdbusinterfaceskeleton: Fix a use-after-free of a GDBusMethodInvocation

Closes #2924

See merge request GNOME/glib!3297
2023-02-23 12:43:54 +00:00
Philip Withnall
7b101588e9 gdbusconnection: Make GDBusMethodInvocation transfer a bit clearer
Add a missing steal call in `schedule_method_call()`. This introduces no
functional changes, but documents the ownership transfer more clearly.

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

Helps: #2924
2023-02-23 12:16:05 +00:00
Philip Withnall
d5710deb9d gdbusinterfaceskeleton: Fix a use-after-free of a GDBusMethodInvocation
This `GDBusMethodInvocation` may be shared across threads, with no
guarantee on the strong ref in one thread outlasting any refs in other
threads — so it needs a ref in this helper struct.

This should fix a use-after-free where the `GDBusMethodInvocation` is
freed from `g_value_unset()` after `g_signal_emit()` returns in
`dispatch_in_thread_func()` in one thread; but then dereferenced again
in `g_source_destroy_internal()` from another thread.

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

Fixes: #2924
2023-02-23 12:16:05 +00:00
Philip Withnall
1f86923766 gdbusinterfaceskeleton: Remove an unnecessary helper struct member
The `GDBusInterfaceSkeleton` is already stored as the source object of
the `GTask` here, with a strong reference.

Storing it again in the task’s data struct is redundant, and makes it
look like the `GDBusInterfaceSkeleton` is being used without holding a
strong reference. (There’s not actually a bug there though: the strong
reference from the `GTask` outlives the data struct, so is sufficient.)

Remove the unnecessary helper struct member to clarify the code a bit.

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

Helps: #2924
2023-02-23 12:16:05 +00:00
Philip Withnall
ac5589128c tests: Add some missing g_thread_join() calls to onceinit test
Running the test under asan was failing as the threads were being
leaked.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-23 12:15:13 +00:00
Philip Withnall
81a42f4c59 gsocketclient: Document ownership of connection_attempts better
This introduces no functional changes; just made it while trying to
debug issue #2925.

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

Helps: #2925
2023-02-23 12:14:29 +00:00
Philip Withnall
5a69cc22dc gdbusconnection: Explicitly destroy an idle source on cleanup
Otherwise it’s possible for it to hang around in the `GMainContext`
after the “send message” operation has finished. In the best case, this
will cause the `GTask` and `GDBusMessage` to not be freed when the
calling code expects. In the worst case, it could cause use-after-free
problems if it derefs allocations which have since been freed.

I have not seen either of these problems in practice, but it would be
best for the code to eliminate the risk of them altogether by explicitly
destroying the source when the operation is finished.

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

Helps: #2925
2023-02-23 12:14:29 +00:00
Simon McVittie
88fd3f0a76 Merge branch 'build-with-llvm-toolchain' into 'main'
Fix building gio/tests/test_resources.o with LLVM ld

Closes #2720

See merge request GNOME/glib!3186
2023-02-22 16:51:05 +00:00
Philip Withnall
0a715be599 Merge branch 'cloexec-other' into 'main'
Close-on-exec flag few missed places

See merge request GNOME/glib!3292
2023-02-22 13:07:35 +00:00
Philip Withnall
ddf85f9d9e Merge branch 'g-win32-app-info-enhancements-2' into 'main'
GWin32AppInfo: Retrieve display name for UWP / Packaged apps

See merge request GNOME/glib!3168
2023-02-22 12:55:24 +00:00
Emmanuele Bassi
4c17e3b122 Merge branch '2907-file-info-docs' into 'main'
gfileinfo: Document required attributes for helper getters

Closes #2907

See merge request GNOME/glib!3261
2023-02-22 12:35:38 +00:00
Luca Bacci
01889cd348 GWin32AppInfo: Retrieve display name of UWP (packaged) apps 2023-02-22 13:24:13 +01:00
Sabri Ünal
df40317a74 Update Turkish translation 2023-02-22 11:55:19 +00:00
Philip Withnall
d8c913ac83 Merge branch 'fix-c4141' into 'main'
gstring.h/gmacros.h: Avoid compiler warnings on Visual Studio

Closes #2905

See merge request GNOME/glib!3285
2023-02-22 03:30:41 +00:00
Chun-wei Fan
c8730dc6f9 gmacros.h: Fix C++ macros for Visual Studio
,,,for G_ALWAYS_INLINE and G_NO_INLINE, since the msvc::forceinline and
msvc::noinline attributes require C++-20 support, not just C++-11
support.  This will avoid warning C5051 (unsupported attribute ...,
ignored) if pre-C++-20 was used.
2023-02-22 10:24:20 +08:00
Chun-wei Fan
994209dbee gstring.h: Avoid compiler warning on Visual Studio
The recent optimizations to gstring.h used G_ALWAYS_INLINE (meaning
'__forceinline' on Visual Studio) together with 'static inline', which
will cause warning C4141 indicating that 'inline' was used more than
once on the function.

Avoid this by temporarily disabling warning C4141 in gstring.h when
building the code that uses 'G_ALWAYS_INLINE'.

Fixes issue #2905.
2023-02-22 10:24:20 +08:00
Emmanuele Bassi
796e21ee1c Merge branch 'w-sign-conversion' into 'main'
tests: Add a -Wsign-conversion test for gstring.h

See merge request GNOME/glib!3275
2023-02-22 01:41:25 +00:00
Emmanuele Bassi
2c14e71162 Merge branch 'no-performance-valgrind' into 'main'
tests: Don’t run the GObject performance tests under valgrind

See merge request GNOME/glib!3279
2023-02-22 01:36:27 +00:00
Emmanuele Bassi
c669baab4c Merge branch 'live-g-file-test-logging' into 'main'
tests: Remove custom printerr logging from live-g-file

See merge request GNOME/glib!3281
2023-02-22 01:36:10 +00:00
Emmanuele Bassi
23d28b9d6e Merge branch '2913-error-warning' into 'main'
gerror: Emit a critical warning if the message format is NULL

Closes #2913

See merge request GNOME/glib!3286
2023-02-22 01:35:24 +00:00
Maciej S. Szmigiero
8f8ebb1bd0 g_mkstemp: Use O_CLOEXEC for race-free setting of the close-on-exec flag
mkstemp-like family of functions also use g_open () under the hood so
they should pass the O_CLOEXEC flag there for race-free setting of the
close-on-exec flag.
2023-02-22 00:38:13 +01:00
Maciej S. Szmigiero
cbc15d6ceb gunixmounts: Use "e" mode flag in setmntent () call for race-free setting of the close-on-exec flag
setmntent () call uses the same mode flag set as fopen (), so it should
also include the "e" mode flag for race-free setting of the close-on-exec
flag.
2023-02-22 00:32:33 +01:00
Maciej S. Szmigiero
7bee4cecdd grand: Use "e" mode flag in fopen () call for race-free setting of the close-on-exec flag
It was missed when other fopen () call sites were converted since the code
had it written as "fopen()" (without space before the opening parenthesis).
2023-02-22 00:29:31 +01:00
Philip Withnall
288521ea02 Merge branch 'g-type-name-can-return-null' into 'main'
g_type_name: Fix return annotation

See merge request GNOME/glib!3290
2023-02-21 22:44:51 +00:00
Philip Withnall
4a5d58715d Merge branch 'wip/pwithnall/more-meson-on-macos-and-windows' into 'main'
ci: Use Meson 1.0.0 on Windows and macOS CI builds

See merge request GNOME/glib!3280
2023-02-21 22:22:00 +00:00
badcel
993f6d6698
g_type_name: Fix return annotation
The function can return null so it should be annotated as nullable.
2023-02-21 22:19:56 +01:00
Philip Withnall
bd2ccc2f69 Merge branch 'fix-windows-spawn-non-english' into 'main'
spawn-test: Fix running on non-English Windows

See merge request GNOME/glib!3288
2023-02-21 17:49:31 +00:00
Luca Bacci
0f0520ffa2 Add VTable definition for IPackage2
Derived from MIT-licensed code:
https://github.com/microsoft/windows-rs/blob/0.43.0/crates/libs/windows/src/Windows/ApplicationModel/mod.rs#L554
2023-02-21 18:01:51 +01:00
Philip Withnall
339aaa3719 Merge branch 'cloexec-audit' into 'main'
Make sure new file descriptors have close-on-exec flag set on them in a race-free way

See merge request GNOME/glib!3283
2023-02-21 12:58:01 +00:00
Maciej S. Szmigiero
0e7bf99ec2 Use "e" mode flag in fopen () calls for race-free setting of the close-on-exec flag
All Unix CRTs examined: glibc, musl, BSDs, Apple libc, Android bionic
ignore unknown fopen () mode flags, so this flag can be added
unconditionally for Unix builds.

Only Windows CRT is intolerant of these, so the single case in
g_dbus_address_connect () where the fopen () call is shared between Unix
and Windows needs appropriate platform-specific handling.

Skipped the call sites in libcharset and xdgmime copylibs.
2023-02-21 12:42:55 +00:00
Maciej S. Szmigiero
3f2e18b07c Use O_CLOEXEC in {g_,}open () calls for race-free setting of the close-on-exec flag
The remaining call sites are either Windows-only, between fork () and
exec () or in xdgmime copylib.

Hope I haven't missed any site.
2023-02-21 12:42:55 +00:00
Maciej S. Szmigiero
0f5d274871 gtestutils: Document that g_test_trap_fork () won't get close-on-exec fix
We don't want to update this function in case some crusty old third party
code might be relying on its current behavior.
Also, it is deprecated anyway and no code should be using it.
2023-02-21 12:42:55 +00:00
Maciej S. Szmigiero
dd36ee0abf gtestdbus: Use g_unix_open_pipe_internal () for creating pipes
This attempts to create the pipes with race-free setting of the
close-on-exec flag.
2023-02-21 12:42:55 +00:00
Maciej S. Szmigiero
05d2a1d097 gbacktrace: Use g_unix_open_pipe_internal () for creating pipes
This attempts to create the pipes with race-free setting of the
close-on-exec flag.
2023-02-21 12:42:55 +00:00
Maciej S. Szmigiero
14b5207bfa Add g_unix_open_pipe_internal () for pipes with the close-on-exec flag
Based on the existing g_unix_open_pipe () but for internal use where
returning a raw errno is needed, not a GError.
2023-02-21 12:42:55 +00:00
Philip Withnall
13fe2e0c79 ci: Enable JIT debugging on msys2-* CI jobs
Suggested by Christoph Reiter, this is a workaround for random Python
crashes in Meson which only appear on this platform.

It’s being tracked upstream at
https://github.com/msys2/MINGW-packages/issues/11864, but unfortunately
it seems hard to fix.

Work around the issue the same way that Meson have in their CI, by
enabling JIT debugging. See
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3280#note_1678973.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-21 11:52:24 +00:00
Daniel
ea87d78c7f Updated Spanish translation 2023-02-21 11:52:42 +01:00