Commit Graph

19693 Commits

Author SHA1 Message Date
Alistair Thomas
94d855fc6d docs: Add note on how to check a gboolean condition 2019-01-07 15:19:41 +00:00
Emmanuele Bassi
4f5f34689f Merge branch 'interface-docs' into 'master'
gtype: Clarify type of GInterfaceInitFunc

See merge request GNOME/glib!512
2019-01-07 14:40:44 +00:00
Philip Withnall
74e4b8396f Merge branch 'bad-liststore' into 'master'
Fix overflow in GListStore

Closes #1639

See merge request GNOME/glib!572
2019-01-07 14:09:59 +00:00
Matthias Clasen
d8a0dcb11e list store: Fix overflow issues
Check for over- and underflow when manipulating positions.

This makes the sequence
  g_list_model_get_item (store, 0);
  g_list_model_get_item (store, -1u);
return NULL for the second call, as it should.

Closes: #1639
2019-01-07 08:53:16 -05:00
Matthias Clasen
471153fb20 liststore: Add a test demonstrating overflow issues
Calling
  g_list_model_get_item (store, 0);
  g_list_model_get_item (store, -1u);
does not return NULL for the second call, as it should.

This was showing up in GTK+ list model tests.
2019-01-07 08:52:47 -05:00
Philip Withnall
eeb657bb0f Merge branch '1637-win32-uninitialised-variable' into 'master'
gwin32appinfo: Fix a potential free of an uninitialised variable

Closes #1637

See merge request GNOME/glib!573
2019-01-07 11:04:22 +00:00
Philip Withnall
29e8f5795d gwin32appinfo: Fix a potential free of an uninitialised variable
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1637
2019-01-07 10:25:46 +00:00
Rico Tzschichholz
245279e834 Merge branch '1636-gtask-getters' into 'master'
gtask: Ensure to return 1 or 0 from getters rather than truthy ints

Closes #1636

See merge request GNOME/glib!570
2019-01-05 09:08:22 +00:00
Philip Withnall
8dced725c2 Merge branch 'annotation-fix' into 'master'
goption: Fix an annotation on g_option_context_parse_strv()

See merge request GNOME/glib!545
2019-01-05 07:57:17 +00:00
Philip Withnall
ae381d795e gtask: Ensure to return 1 or 0 from getters rather than truthy ints
Since commit 290bb0dd, where various members of GTask were converted to
a bitfield, some of the getters:
 • g_task_get_check_cancellable()
 • g_task_get_return_on_cancel()
 • g_task_get_completed()
have been returning truthy ints (zero or an arbitrary non-zero integer)
as boolean values, rather than the canonical boolean ints of 1 and 0.

This broke the `yield` statement in Vala, whose generated C code
compares `g_task_get_completed (…) != TRUE`. i.e. Whether the
`completed` field has a value not equal to 1.

Fix this by explicitly converting truthy ints to canonical boolean ints
in all getters.

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

https://gitlab.gnome.org/GNOME/glib/issues/1636
2019-01-05 07:51:14 +00:00
Philip Withnall
33158c86c1 Merge branch 'wip/nacho/gpoll' into 'master'
win32 gpoll: overcome the 64 handles limit

See merge request GNOME/glib!535
2019-01-04 11:20:11 +00:00
Simon McVittie
f63b1da918 Merge branch 'iface-init-docs' into 'master'
gtype: Document type for iface_default_init() function

See merge request GNOME/glib!564
2019-01-03 20:07:14 +00:00
Simon McVittie
986b0a5965 Merge branch '1055-will-the-alignment-never-end' into 'master'
gmacros: Don’t use __alignof__ in G_ALIGNOF implementation

Closes #1055

See merge request GNOME/glib!559
2019-01-03 09:42:52 +00:00
Anders Jonsson
cfd2e83709 Update Swedish translation 2018-12-29 22:45:17 +00:00
Ignacio Casal Quinteiro
7f1023b0b8 Use lowercase to include winsock2 2018-12-28 15:30:28 +01:00
Ignacio Casal Quinteiro
97f4ce5a77 meson: build gpoll test on windows 2018-12-28 14:41:53 +01:00
Ignacio Casal Quinteiro
a9ea169b64 win32: increase the fds and pollees on the gpoll test
Also change the repeat define to do a single pass so we do
not timeout
2018-12-28 13:28:43 +01:00
Ignacio Casal Quinteiro
24714b50df win32 gpoll: overcome the 64 handles limit
This is a new polling method allowing to poll more than 64 handles
based on the glib one.
When we reach the limit of 64 we create a thread and we poll
on that thread for a batch of handles this way we overcome the limit.

https://gitlab.gnome.org/GNOME/glib/issues/1071
2018-12-28 13:28:43 +01:00
Ignacio Casal Quinteiro
0d2f7074ea gpoll: rename timeout to timeout_ms for clarity 2018-12-28 13:28:43 +01:00
Philip Withnall
154b24c055 gtype: Document type for iface_default_init() function
And mention why it’s not a GInterfaceInitFunc as people who have read
the GObject docs cover-to-cover might expect.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-27 23:46:42 +00:00
Philip Withnall
db0bce02cb Merge branch 'win32-spawn-escaping' into 'master'
gspawn, win32: qouted args - escape end backslash

See merge request GNOME/glib!419
2018-12-27 12:52:04 +00:00
Vasily Galkin
22e875f710 gspawn, win32: quoted args - escape end backslash
According to msdn documentation last backslash(es) of quoted argument
in a win32 cmdline need to be escaped, since they are
directly preceding quote in the resulting string:
https://docs.microsoft.com/en-us/cpp/c-language/parsing-c-command-line-arguments

Glib <=2.58.0 passed children arguments like C:\Program Files\
without escaping last backslash(es).
So it had been passed as "C:\Program Files\"
windows command line parsing treated this as escaped quote,
and later text was treated as argument continuation instead of separate
arguments.

Existing implementation wasn't easily adoptable to fix this problem,
so escaping logic was rewritten.
Since the resulting length need to be increased due to extra escaping
it was rewritten too. Now the calculated length assumes that all
escapable chars would be escaped in a resulting string,
so the length may be a bit bigger than actually needed,
since backslashes not preceding quotes are not escaped.

This fixes the glib/tests/spawn-singlethread.c test
(which introduced testing for special chars to make this problem
testable).
The problem itself was found during investigations about fixing
related https://gitlab.gnome.org/GNOME/glib/issues/1566

The logic is duplicated in protect_argv_string() and protect_wargv() funcs.
However there is no single obvious way to get rid of duplication -
https://gitlab.gnome.org/GNOME/glib/merge_requests/419#note_371483

So by now adding a note referencing protect_wargv from protect_argv_string,
the other direction is already referenced.
2018-12-27 00:06:58 +03:00
Vasily Galkin
f7f597c841 gspawn, win32: fix child stderr when coverage enabled
This fixes test that were added in previous commit:
checking for empty stderr failed with coverage enabled, since
coverage warnings printed from gspawn-win32-helper process were treated
as child output. This is fixed by removing redirection after child
finishes execution.

The dup_noninherited renamed to reopen_noninherited,
since it actually always closes passed file descriptor.
2018-12-27 00:00:50 +03:00
Vasily Galkin
cafb61a179 gspawn, win32: fix redirecting only stderr
Problem was just a typo - wrong variable was checked before enabling
stderr redirection.
This fixes error-only redirection spawn-test added in previous commit.

Behavior while redirecting only stdout should be unaffected,
since old code tried to redirect stderr to -1 in such case,
which silently failed I think.
2018-12-26 23:55:28 +03:00
Vasily Galkin
50cb4f221c gspawn, tests: extend spawn_test, run it on win32
The spawn_test is enabled on win32 meson build, both msys and msvc.

Some modifications to make it useful for auto-testing on win32:
- use own argv0 to find helper win32-specific subprogram
- helper subprogram and conditions changed, so testing is fully
automated instead of manually checking contents of some MessageBoxes

Redirection test checks "sort" output for locale-independent string
instead of relying on "netstat" locale-dependent string.
Also with "sort" it become usable on unix, so enabled there too.
Currently this fails on win32 with coverage since
some coverage-realted error output from gpawn-win32-helper
is unexpectedly treated as executed subprocess output.


Added test checking "sort" with error-only redirection. This also fails
on win32 by now, due to a typo in gspawn-win32.c (checks for stdout
redirection instead of stderr)
2018-12-26 23:45:47 +03:00
Vasily Galkin
387739b018 gspawn, tests: check passing special chars in args
The existing singlethread g_spawn_sync test is modified and now tests
that special characters in arguments are correctly passed to child.
The test is added before spawn escaping fixing on win32
and covers the case currently broken on win32:
'trailing \ in argument containing space'.
2018-12-26 23:30:57 +03:00
Philip Withnall
940537bec7 Merge branch '1623-gio-open-docs' into 'master'
docs: Mention handling of filenames containing colons in gio docs

Closes #1623

See merge request GNOME/glib!550
2018-12-23 22:09:22 +00:00
Matthias Clasen
07f1bcfecc Merge branch 'docs-gsettings-backend-dconf' into 'master'
docs: Fix dconf GSETTINGS_BACKEND name in gio overview

See merge request GNOME/glib!560
2018-12-23 21:48:46 +00:00
Philip Withnall
37f41eb44a 2.59.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-23 13:06:57 +00:00
Tapasweni Pathak
2dc82840c8 Add g_queue_clear_full API
Closes https://gitlab.gnome.org/GNOME/glib/merge_requests/378.
2018-12-22 14:36:56 +05:30
Mart Raudsepp
2ab231f52a docs: Fix dconf GSETTINGS_BACKEND name in gio overview 2018-12-21 17:38:06 +02:00
Philip Withnall
ab56f0459c tests: Add test for G_ALIGNOF()
To guarantee that its behaviour is always the same as the
G_STRUCT_OFFSET fallback.

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

https://gitlab.gnome.org/GNOME/glib/issues/1055
2018-12-21 13:22:55 +00:00
Philip Withnall
b7d2eeed17 gmacros: Don’t use __alignof__ in G_ALIGNOF implementation
It has different semantics from _Alignof and our G_STRUCT_OFFSET
fallback. See the comments in the diff for details.

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

https://gitlab.gnome.org/GNOME/glib/issues/1055
2018-12-21 13:09:57 +00:00
Philip Withnall
ea0da960ab Merge branch 'issues/1620' into 'master'
Issues/1620

See merge request GNOME/glib!554
2018-12-21 12:46:38 +00:00
Philip Withnall
87ea4ce1ff Merge branch 'gdbus-codegen-propemitschanged' into 'master'
honor "Property.EmitsChangedSignal" annotations

Closes #542

See merge request GNOME/glib!532
2018-12-21 12:34:55 +00:00
Philip Withnall
ac974a721f Merge branch 'suppress-int-in-bool-context-warning-with-g++' into 'master'
Suppress -Wint-in-bool-context warning with G_DEFINE_INTERFACE and g++

See merge request GNOME/glib!555
2018-12-21 12:16:30 +00:00
Kouhei Sutou
b8ac6e146a Suppress -Wint-in-bool-context warning with G_DEFINE_INTERFACE and g++
Note that it's not reported with gcc. It's only reported with g++.

C++ code to reproduce this warning:

    #include <glib-object.h>

    G_BEGIN_DECLS

    #define GARROW_TYPE_FILE (garrow_file_get_type())
    G_DECLARE_INTERFACE(GArrowFile,
                        garrow_file,
                        GARROW,
                        FILE,
                        GObject)

    struct _GArrowFileInterface {
      GTypeInterface g_iface;
    };

    G_DEFINE_INTERFACE(GArrowFile,
                       garrow_file,
                       G_TYPE_OBJECT)

    static void
    garrow_file_default_init(GArrowFileInterface *iface)
    {
    }

    G_END_DECLS

Build command line:

    % g++ -Wall -shared -o liba.so a.cpp $(pkg-config --cflags --libs gobject-2.0)

Message:

    In file included from /tmp/local.glib/include/glib-2.0/gobject/gobject.h:24,
                     from /tmp/local.glib/include/glib-2.0/gobject/gbinding.h:29,
                     from /tmp/local.glib/include/glib-2.0/glib-object.h:23,
                     from a.cpp:1:
    a.cpp: In function 'GType garrow_file_get_type()':
    /tmp/local.glib/include/glib-2.0/gobject/gtype.h:219:50: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
     #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
                                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/local.glib/include/glib-2.0/gobject/gtype.h:2026:11: note: in definition of macro '_G_DEFINE_INTERFACE_EXTENDED_BEGIN'
           if (TYPE_PREREQ) \
               ^~~~~~~~~~~
    /tmp/local.glib/include/glib-2.0/gobject/gtype.h:1758:47: note: in expansion of macro 'G_DEFINE_INTERFACE_WITH_CODE'
     #define G_DEFINE_INTERFACE(TN, t_n, T_P)      G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;)
                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    a.cpp:16:1: note: in expansion of macro 'G_DEFINE_INTERFACE'
     G_DEFINE_INTERFACE(GArrowFile,
     ^~~~~~~~~~~~~~~~~~
    /tmp/local.glib/include/glib-2.0/gobject/gtype.h:178:25: note: in expansion of macro 'G_TYPE_MAKE_FUNDAMENTAL'
     #define G_TYPE_OBJECT   G_TYPE_MAKE_FUNDAMENTAL (20)
                             ^~~~~~~~~~~~~~~~~~~~~~~
    a.cpp:18:20: note: in expansion of macro 'G_TYPE_OBJECT'
                        G_TYPE_OBJECT)
                        ^~~~~~~~~~~~~
2018-12-20 11:24:53 +09:00
Cosimo Cecchi
dec0a6874e gdbusproxy: only connect to NameOwnerChanged for message buses
Names are a message bus feature, so it does not make sense to connect
to NameOwnerChanged when the underlying connection is not a message
bus.

Moreover, g_dbus_connection_signal_subscribe() will also enforce that
condition. Adding this extra check here is helpful to avoid a critical
warning when using GDBusProxy with peer-to-peer connections.

https://gitlab.gnome.org/GNOME/glib/issues/1620
2018-12-20 00:41:19 +00:00
Cosimo Cecchi
7d02e32644 gdbusconnection: add a getter for the flags property
Right now this can only be set at construction but not read back.
That seems unnecessarily restrictive, and we'll need to read these
flags from outside of gdbusconnection.c in the next commit, so let's
just make it public.

https://gitlab.gnome.org/GNOME/glib/issues/1620
2018-12-20 00:41:13 +00:00
Philip Withnall
3924ef6ac1 Merge branch 'glib-gresource-ld-binary' into 'master'
glib-compile-resources: Add external data option

Closes #1489

See merge request GNOME/glib!553
2018-12-19 17:10:00 +00:00
Ninja-Koala
d04b9c371d glib-compile-resources: Add external data option
Add option to not encode resource data into the C source file
in order to embed the data using `ld -b binary`. This improves compilation
times, but can only be done on Linux or other platforms with a
supporting linker.

(Rebased by Philip Withnall, fixing minor rebase conflicts.)

Fixes #1489
2018-12-19 16:43:21 +00:00
António Fernandes
3da40e9036 gutils: Use no-break space in g_format_size()
It's undesirable for quantity and unit to be separated by line breaks.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1625
2018-12-19 16:27:14 +00:00
Emmanuele Bassi
c33a98f42f Merge branch 'fix-gsubprocess-tests' into 'master'
Revert "tests: Fix GOptionContext leak in GSubprocess tests"

See merge request GNOME/glib!551
2018-12-19 15:14:29 +00:00
Philip Withnall
ccb3486543 Revert "tests: Fix GOptionContext leak in GSubprocess tests"
This reverts commit 52bab0254a.

It silently conflicted with another commit,
90ca3b4dd0, which was merged later than
it. I’ve kept commit 90ca3b because it also frees the GError; 52bab
doesn’t.

This is my failure to rebase and test old branches before merging them,
instead of assuming that the lack of automatically detected merge
conflicts actually means there are no merge conflicts.
2018-12-19 14:54:27 +00:00
Emmanuele Bassi
b709c6bde4 Merge branch 'rw-lock-docs' into 'master'
gthread: Clarify priority handling in GRWLock

See merge request GNOME/glib!376
2018-12-19 13:27:49 +00:00
Emmanuele Bassi
48c2d94d7b Merge branch 'gmarkup-docs' into 'master'
gmarkup: Make the documentation even more explicit about untrusted input

See merge request GNOME/glib!332
2018-12-19 13:27:05 +00:00
Philip Withnall
499e08a462 Merge branch 'gtask-set-name' into 'master'
gtask: Add a g_task_set_name() method

See merge request GNOME/glib!384
2018-12-19 13:16:07 +00:00
Philip Withnall
0b80445b0c Merge branch 'gsubprocess-communicate-utf8-tests' into 'master'
Add UTF-8 communication tests for GSubprocess

See merge request GNOME/glib!381
2018-12-19 13:15:04 +00:00
Philip Withnall
a81aa3cb96 Merge branch 'rc-align' into 'master'
Align the reference counted allocations

Closes #1581

See merge request GNOME/glib!473
2018-12-19 12:30:57 +00:00
Philip Withnall
ed007bb4cf docs: Mention handling of filenames containing colons in gio docs
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1623
2018-12-19 12:24:17 +00:00