Commit Graph

19858 Commits

Author SHA1 Message Date
Christoph Reiter
0cf55f4fd9 gtypes: add g-i annotations for G_MININT macros. Fixes #1673
They were changed in 6a2cfde2 to reuse the G_MAXINT values but
parsing nexted macros is currently broken in g-i and results in wrong
values.

Add value annotations for g-i to override the values.

This also moves the annotations to the macro definitions to have
everything g-i uses in one place.
2019-02-01 15:04:57 +01:00
Philip Withnall
66f3016026 Merge branch 'ignore-more-decorators' into 'master'
docs: Ignore more version macros

See merge request GNOME/glib!630
2019-02-01 09:41:50 +00:00
Matthias Clasen
fc6044a4b1 Define enum types for Unicode enums
We want to stop shipping PangoScript in pango, so
we need a replacement for the type that used to
be provided by pango.
2019-01-31 19:38:26 -05:00
Philip Withnall
5360fd0666 Merge branch '1224-tsan-fixes' into 'master'
Patches to improve GObject and GThread with TSAN

Closes #1224

See merge request GNOME/glib!383
2019-02-01 00:25:33 +00:00
Matthias Clasen
bca4ff7c5e Support the trash portal
When we are in a sandbox, try to trash files via a portal.
It works.
2019-01-31 19:00:19 -05:00
Krzesimir Nowak
9babfecba8 docs: Ignore more version macros
Looks like we tend to forget to update the list of ignored decorators
when adding new version macros.
2019-01-31 21:52:40 +01:00
Colin Walters
630fa82ed0 gthread: Rework to avoid holding a mutex half the time
This code was a persistent source of `-fsanitize=thread` errors
when I was trying to use it on OSTree.

The problem is that while I think this code is functionally correct,
we hold a mutex during the writes, but not the reads, and TSAN (IMO
correctly) flags that.

Reading this, I don't see a reason we need a mutex at all.  At the
cost of some small code duplication between posix/win32, we can just
pass the data we need down into each implementation.  This ends up
being notably cleaner I think than the awkward "lock/unlock to
serialize" dance.

(Minor review changes made by Philip Withnall <withnall@endlessm.com>.)

https://gitlab.gnome.org/GNOME/glib/issues/1224
2019-01-31 13:19:29 +00:00
Colin Walters
4631cd892d gobject: Change assertions to read values via atomics
I'm trying to use `-fsanitize=thread` for OSTree, and some of
these issues seem to go into GLib.  Also, the sanitizers work better if
the userspace libraries are built with them too.

This fix is similar to
b6814bb37c

Mixing atomic and non-atomic reads trips TSAN, so let's change the
assertions to operate on the local values returned from atomic
read/writes.

Without this change I couldn't even *build* GLib with TSAN, since we
use gresources during compilation, which uses GSubprocess, which hits
this code.

(Minor review fixes made by Philip Withnall <withnall@endlessm.com>.)

https://gitlab.gnome.org/GNOME/glib/issues/1224
2019-01-31 13:18:40 +00:00
Philip Withnall
097dc30ad9 Merge branch 'fixing_warnings' into 'master'
Fixing warnings

See merge request GNOME/glib!622
2019-01-31 13:15:23 +00:00
Emmanuel Fleury
5d78256796 Silencing cast-function-type warnings
A lot of code cast function pointer to incorrect types. There is no
other way but silencing the warning. Follows an example of such cast:

glib/glist.c: In function ‘g_list_free_full’:
glib/glist.c:223:25: error: cast between incompatible function types from ‘GDestroyNotify’ {aka ‘void (*)(void *)’} to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
   g_list_foreach (list, (GFunc) free_func, NULL);
                         ^
2019-01-31 10:24:39 +01:00
Emmanuel Fleury
4cd8fccc11 Fixing missing initializer in g_static_rec_mutex_init()
glib/deprecated/gthread-deprecated.c: In function ‘g_static_rec_mutex_init’:
glib/deprecated/gthread-deprecated.c:657:3: error: missing initializer for field ‘depth’ of ‘GStaticRecMutex’ {aka ‘const struct _GStaticRecMutex’} [-Werror=missing-field-initializers]
   static const GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
   ^~~~~~
In file included from glib/deprecated/gthread-deprecated.c:30:
glib/deprecated/gthread.h:161:9: note: ‘depth’ declared here
   guint depth;
         ^~~~~
2019-01-31 10:24:32 +01:00
Simon McVittie
52b8947bf6 Merge branch 'settings-test-cleanups-subset' into 'master'
Various memory leak cleanups to GSettings tests (subset)

See merge request GNOME/glib!629
2019-01-30 18:56:28 +00:00
Philip Withnall
6c14e9a14b tests: Fix a minor memory leak in the gsettings test
g_settings_backend_get_default() returns a strong reference.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-30 14:41:15 +00:00
Philip Withnall
caf5103d4b gsettingsbackend: Fix a minor memory leak
This never caused any problems because the default GSettingsBackend is
cached forever by GIOModule anyway.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-30 14:41:15 +00:00
Philip Withnall
5beed066d1 glib.supp: Add suppressions from gsettings test
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-30 14:41:15 +00:00
Philip Withnall
f829b65e51 gsettings: Clarify ownership transfer in a few places
I was trying to debug some memory leaks in the gsettings test.
Eventually, it seems that actually they’re caused by the
GMemorySettingsBackend being cached by GIOModule — so this commit makes
no functional changes. It should make the code and documentation a bit
clearer though.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-30 14:41:15 +00:00
Philip Withnall
9d89ed0c54 gkeyfilesettingsbackend: Add a code comment to clarify things
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-30 14:41:15 +00:00
Philip Withnall
799b6678be Merge branch 'wip/sadiq/fixes' into 'master'
gmarkup: Optimize g_markup_escape_text()

Closes #1376

See merge request GNOME/glib!328
2019-01-30 14:36:14 +00:00
Mohammed Sadiq
2934dfa2bd gmarkup: Optimize g_markup_escape_text() 2019-01-30 14:36:14 +00:00
Michael Catanzaro
930883609c Merge branch 'wip/tingping/gsocketclient-criticals' into 'master'
gsocketclient: Fix criticals

Closes #1649 and #1646

See merge request GNOME/glib!627
2019-01-29 20:59:18 +00:00
Patrick Griffis
d553d92d6e gsocketclient: Fix criticals
This ensures the parent GTask is kept alive as long as an enumeration
is running and trying to connect.

Closes #1646
Closes #1649
2019-01-29 14:46:52 -05:00
Philip Withnall
2a9ddc6303 Merge branch 'wip/ernestask/gcc-9-null-directive-argument' into 'master'
gdbus: Avoid printing null strings

See merge request GNOME/glib!626
2019-01-29 11:25:37 +00:00
Ernestas Kulik
566e1d61a5 gdbus: Avoid printing null strings
This mostly affects the 2.56 branch, but, given that GCC 9 is being
stricter about passing null string pointers to printf-like functions, it
might make sense to proactively fix such calls.

gdbusauth.c: In function '_g_dbus_auth_run_server':
gdbusauth.c:1302:11: error: '%s' directive argument is null
[-Werror=format-overflow=]
 1302 |           debug_print ("SERVER: WaitingForBegin, read '%s'",
 line);
       |

gdbusmessage.c: In function ‘g_dbus_message_to_blob’:
gdbusmessage.c:2730:30: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
 2730 |       tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
      |
2019-01-29 11:06:39 +01:00
Philip Withnall
08e5c89dfc Merge branch 'wip/oholy/gappinfo-async' into 'master'
Make `g_app_info_launch_uris_async()` really asynchronous

Closes #1249 and #1347

See merge request GNOME/glib!609
2019-01-28 16:27:07 +00:00
Simon McVittie
92881babba Merge branch '1642-message-blob-size' into 'master'
gdbusmessage: Fix check on upper limit of message size

Closes #1642

See merge request GNOME/glib!623
2019-01-28 15:45:15 +00:00
Ondrej Holy
051c6ba4e7 gio-tool-open: Use g_app_info_launch_default_for_uri_async()
The recent changes of the g_app_info_launch_default_for_uri_async()
function ensures that the callback is not called before DBus-activated
applications start. Let's use g_app_info_launch_default_for_uri_async()
and remove the workarounds for DBus-activated applications.

Closes: https://gitlab.gnome.org/GNOME/glib/issues/1249
2019-01-28 16:42:34 +01:00
Ondrej Holy
904bb264e9 gappinfo: Use g_app_info_launch_uris_async() for async calls
Currently, the g_app_info_launch_default_for_uri_async() function uses
g_app_info_launch_uris(), which is not fully asynchronous and may cause
for example Nautilus freezes. Let's use the g_app_info_launch_uris_async()
function to prevent the freezes.

Closes: https://gitlab.gnome.org/GNOME/glib/issues/1347
https://gitlab.gnome.org/GNOME/glib/issues/1249
2019-01-28 16:42:34 +01:00
Ondrej Holy
cec5778cad gappinfo: Add launch_uris_async() and launch_uris_finish() vfuncs
The g_app_info_launch_uris_async() and g_app_info_launch_uris_finish()
functions are crucial to fix g_app_info_launch_default_for_uri_async()
to be really asynchronous.

This patch also adds GDesktopAppInfo implementation of that vfuncs.
The implementation may still use some synchronous calls to local MIME DB.

https://gitlab.gnome.org/GNOME/glib/issues/1347
https://gitlab.gnome.org/GNOME/glib/issues/1249
2019-01-28 16:42:34 +01:00
Ondrej Holy
f72a5d65e0 gfile: Add g_file_query_default_handler_async()
This is needed as a first step to fix the
g_app_info_launch_default_for_uri_async() function to be really
asynchronous.

It still uses the g_app_info_get_default_for_uri_scheme() and
g_app_info_get_default_for_type() functions, which may use synchronous
calls to local MIME DB.

https://gitlab.gnome.org/GNOME/glib/issues/1347
https://gitlab.gnome.org/GNOME/glib/issues/1249
2019-01-28 16:42:34 +01:00
Ondrej Holy
0a1730d7ea gfile: Fix leak in g_file_query_default_handler()
Add missing `g_free (uri_scheme)` to fix leak when `uri_scheme[0]`
is equal to `\0`.
2019-01-28 16:42:34 +01:00
Philip Withnall
31b0ba18c1 gdbusmessage: Fix check on upper limit of message size
There was a typo in the figure checked against. Add a unit test.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1642
2019-01-28 14:37:22 +00:00
Emmanuel Fleury
6e49b36cc2 Fixing signedness in glib/gdate.c
glib/gdate.c: In function ‘g_date_add_months’:
glib/gdate.c:1732:27: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
   g_return_if_fail (years <= G_MAXUINT16 - d->year);
                           ^~
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/gdate.c:1732:3: note: in expansion of macro ‘g_return_if_fail’
   g_return_if_fail (years <= G_MAXUINT16 - d->year);
   ^~~~~~~~~~~~~~~~
glib/gdate.c: In function ‘g_date_add_years’:
glib/gdate.c:1816:28: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
   g_return_if_fail (nyears <= G_MAXUINT16 - d->year);
                            ^~
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/gdate.c:1816:3: note: in expansion of macro ‘g_return_if_fail’
   g_return_if_fail (nyears <= G_MAXUINT16 - d->year);
   ^~~~~~~~~~~~~~~~
2019-01-28 15:29:21 +01:00
Emmanuel Fleury
a419146578 Fixing signedness in g_ptr_array_insert():glib/garray.c
glib/garray.c: In function ‘g_ptr_array_insert’:
glib/garray.c:1522:14: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
   if (index_ < rarray->len)
              ^
2019-01-28 15:29:21 +01:00
Emmanuel Fleury
3384ed3f7f Fixing signedness warnings in glib/gdatetime.c
glib/gdatetime.c: In function ‘get_iso8601_int’:
glib/gdatetime.c:1142:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   for (i = 0; i < length; i++)
                 ^
glib/gdatetime.c: In function ‘get_iso8601_seconds’:
glib/gdatetime.c:1175:9: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   if (i == length)
         ^~
glib/gdatetime.c:1178:12: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   for (; i < length; i++)
            ^
In file included from glib/glibconfig.h:9,
                 from glib/gtypes.h:32,
                 from glib/gtimezone.h:27,
                 from glib/gdatetime.h:31,
                 from glib/gdatetime.c:62:
glib/gdatetime.c: In function ‘initialize_alt_digits’:
glib/gdatetime.c:2806:27: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘long int’ [-Werror=sign-compare]
       g_assert (digit_len < buffer + sizeof (buffer) - buffer_end);
                           ^
glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
 #define G_LIKELY(expr) (expr)
                         ^~~~
glib/gdatetime.c:2806:7: note: in expansion of macro ‘g_assert’
       g_assert (digit_len < buffer + sizeof (buffer) - buffer_end);
       ^~~~~~~~
2019-01-28 15:29:14 +01:00
Emmanuel Fleury
b8efd0df41 Fixing signedness in digest_to_string:glib/gchecksum.c
glib/gchecksum.c: In function ‘digest_to_string’:
glib/gchecksum.c:186:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
   for (i = 0; i < digest_len; i++)
                 ^
2019-01-28 15:26:43 +01:00
Emmanuel Fleury
bfedf0f144 Fixing signedness in gdataset.c
glib/gdataset.c: In function ‘g_datalist_clear_i’:
glib/gdataset.c:233:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint32’ {aka ‘unsigned int’} [-Werror=sign-compare]
       for (i = 0; i < data->len; i++)
                     ^
glib/gdataset.c: In function ‘g_datalist_clear’:
glib/gdataset.c:270:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint32’ {aka ‘unsigned int’} [-Werror=sign-compare]
       for (i = 0; i < data->len; i++)
                     ^
glib/gdataset.c: In function ‘g_datalist_foreach’:
glib/gdataset.c:1147:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint32’ {aka ‘unsigned int’} [-Werror=sign-compare]
       for (j = 0; j < d->len; j++)
                     ^
2019-01-28 15:24:06 +01:00
Emmanuel Fleury
5ca8c2fa8f Fixing signedness in g_ptr_array_maybe_expand():garray.c
../glib.git/glib/garray.c: In function ‘g_ptr_array_maybe_expand’:
../glib.git/glib/garray.c:1172:43: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘gint’ {aka ‘int’} [-Werror=sign-compare]
   if G_UNLIKELY ((G_MAXUINT - array->len) < len)
2019-01-28 15:24:06 +01:00
Emmanuel Fleury
9402940919 Fixing signedness warning in sindent():gtester.c
../glib.git/glib/gtester.c: In function ‘sindent’:
../glib.git/glib/gmacros.h:351:26: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                          ^
../glib.git/glib/gtester.c:73:7: note: in expansion of macro ‘MIN’
   n = MIN (n, l);
       ^~~
../glib.git/glib/gmacros.h:351:41: error: operand of ?: changes signedness from ‘int’ to ‘guint’ {aka ‘unsigned int’} due to unsignedness of other operand [-Werror=sign-compare]
 #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                                         ^~~
../glib.git/glib/gtester.c:73:7: note: in expansion of macro ‘MIN’
   n = MIN (n, l);
       ^~~
2019-01-28 15:23:34 +01:00
Philip Withnall
140b82083f Merge branch 'trash-mount-points-master' into 'master'
Don't fail trash test if ~/.local doesn't exist or mount points can't be determined (master)

See merge request GNOME/glib!593
2019-01-28 13:53:36 +00:00
Philip Withnall
80f2c96a45 Merge branch 'portals-no-o-path' into 'master'
gio: do not pass O_PATH file descriptors to portal APIs

See merge request GNOME/glib!585
2019-01-28 12:58:03 +00:00
Philip Withnall
79d5e1432d Merge branch 'docs' into 'master'
gvariant: Fix a mistake in docs

See merge request GNOME/glib!619
2019-01-28 12:42:55 +00:00
Daniel Mustieles
5a79548572 Updated Spanish translation 2019-01-28 13:06:32 +01:00
Fran Dieguez
337889e7fc Update Galician translation 2019-01-27 22:04:42 +00:00
Balázs Úr
f0720c727f Update Hungarian translation 2019-01-27 14:56:13 +00:00
Krzesimir Nowak
09eb87ad55 gvariant: Fix a mistake in docs
So now the docs actually match what the code does.
2019-01-26 21:45:34 +01:00
Philip Withnall
2d46dff03e 2.59.1
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-01-26 12:16:35 +00:00
Philip Withnall
eb589e2bfe tests: Ensure GCancellable is cancelled before operation is started
In the writev() tests, the handling of cancellation is tested. However,
the GCancellable was cancelled after the writev_async() call was
started. Depending on the implementation of the writev() vfunc, the
operation could be done in a thread or in callbacks on the current
thread’s main loop. If done in a separate thread, there’s a chance that
enough of the write could happen before cancellation reaches that thread
that the overall operation returns success with a short write.

That would cause the test to fail, sometimes.

Avoid that by cancelling the GCancellable before starting the writev()
operation.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2019-01-26 12:16:35 +00:00
Anders Jonsson
50d628d859 Update Swedish translation 2019-01-25 21:36:48 +00:00
Philip Withnall
cc95f819e2 Merge branch '424-gdbus-proxy-debugging' into 'master'
gdbusproxy: Add G_DBUS_DEBUG=proxy support

Closes #424

See merge request GNOME/glib!618
2019-01-25 14:42:52 +00:00
Philip Withnall
1275ddb794 Merge branch 'gdbus-proxy-test-fixes' into 'master'
gdbus-proxy test fails with GLib-GIO:ERROR:glib/gio/tests/gdbus-proxy.c:832:fail_test: code should not be reached

See merge request GNOME/glib!598
2019-01-25 14:42:05 +00:00