Commit Graph

17806 Commits

Author SHA1 Message Date
Simon McVittie
0c0b1bdd0a g_type_check_value, g_type_check_value_holds: accept const argument
Conceptually, these functions clearly ought to be fine for a const
structure. This avoids _G_TYPE_CVH (the implementation of
G_TYPE_CHECK_VALUE_TYPE, G_VALUE_HOLDS, G_VALUE_HOLDS_BOXED etc.)
needing to cast to a mutable GValue, which causes
G_VALUE_HOLDS (cv, type) to issue warnings under gcc -Wcast-qual if
cv is a const GValue *.

https://bugzilla.gnome.org/show_bug.cgi?id=734479
2017-12-13 17:15:16 +00:00
Jens Georg
f5804275af gdbus-codegen: Clarify license of generated code
https://bugzilla.gnome.org/show_bug.cgi?id=780893
2017-12-13 14:09:05 +00:00
Patrick Welche
b6b74402d6 glib-mkenums: best effort attempt on non-utf8 encoded files.
Some source files aren't valid utf-8 containing for example
iso8859-1 accented characters in author's names.
Replace invalid data with a replacement '?' character and print a
warning to keep things working.
Based on a patch from Christoph Reiter in
https://bugzilla.gnome.org/show_bug.cgi?id=785113#c20
2017-12-13 13:40:43 +00:00
Philip Withnall
6a597f93f6 gtestutils: Add missing include
memcmp() is used, which is declared in string.h. Include that.

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

https://bugzilla.gnome.org/show_bug.cgi?id=791532
2017-12-13 13:15:37 +00:00
Philip Withnall
12fa92dcfa docs: Split GSocketConnectable/GProxyAddressEnumerator documentation
Putting them in the same section causes gtk-doc to mix their properties
together in a single listing, which is confusing.

Since having them in a single section doesn’t really add anything, split
them out to one class per section.

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

https://bugzilla.gnome.org/show_bug.cgi?id=791334
2017-12-12 11:42:45 +00:00
Xavier Claessens
fa8d42de2e Meson: Fix build of gtkdoc
This requires change added in Meson 0.44.0

https://bugzilla.gnome.org/show_bug.cgi?id=786796
2017-12-11 10:25:21 -05:00
Friedrich Beckmann
6d0210240a MacOS: gosxcontenttype.c consider generic icon names also
This patch considers generic icon names also when icon names
are searched based on content type. Without this fix only
non-generic icon names are found. This results in no icons
for pdf and jpeg files in the file selection dialog.
This is discussed in

https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-12-11 11:40:14 +00:00
Emmanuele Bassi
1a6f6487b7 Disable refcounting type propagation with C++
The type propagation breaks the GRefPtr.h class in WebKitGTK, and in
any case existing C++ code calling the C API will need to perform an
explicit cast, as there's no automatic promotion of pointer types to
and from void*.

Tested-by: GNOME Continuous

https://bugzilla.gnome.org/show_bug.cgi?id=790697
2017-12-09 00:57:59 +00:00
Mario Sanchez Prada
637a298960 gio/tests/appinfo: New test for launch with "appId-less" applications
New test to make sure we exercise the code paths in gdesktopappinfo.c
that get triggered when g_desktop_app_info_launch_uris_with_spawn()
is used (i.e. unknown app ID, no session bus), both for when either
a single URI or multiple ones are expected by the application.

https://bugzilla.gnome.org/show_bug.cgi?id=791337
2017-12-08 13:47:23 +00:00
Mario Sanchez Prada
d501bd0dbe gdesktopappinfo: Gracefully handle NULL URIs when passed to expand_macro()
If an application calls g_app_info_launch_uris() with a GList that includes
NULL values in some of its data members, and GIO ends up internally calling
g_desktop_app_info_launch_uris_with_spawn() for whatever reason (e.g. no
D-Bus session available), expand_macro() will crash due to the invalid data.

As this is considered a programmer error, use g_return_val_if_fail() in those
situations to prevent the crash from happening, but printing a warning anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=791337
2017-12-08 13:47:23 +00:00
Mario Sanchez Prada
fbed9c8b85 gdesktopappinfo: Pass a copy of the URIs list to expand_application_parameters()
This list will be modified in-place when calling expand_macro(), so pass a copy
of it instead the original pointer, that is supposed to be an input parameter
only for g_desktop_app_info_launch_uris_with_spawn().

https://bugzilla.gnome.org/show_bug.cgi?id=791337
2017-12-08 13:47:23 +00:00
Emmanuele Bassi
9f3f089e60 Use escaped version of typeof
When compiling code that includes gobject.h using GCC with the ISO
standard, the `typeof` keyword is disabled, as it's a GCC extension.

The GCC documentation recommends:

> If you are writing a header file that must work when included in
> ISO C programs, write __typeof__ instead of typeof.

Which is precisely what we're going to do.

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
Reviewed-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790697
2017-12-08 12:56:55 +00:00
Christian Hergert
3fae39a5d7 gobject: add type propagation to gobject ref API
Currently, g_object_ref() and g_object_ref_sink() return a
gpointer which can mask issues when assigning to fields or
returning from a function.

To help catch these type of programming errors, we can propagate
the type of the parameter through the function call on GCC
using the typeof() C language extension.

This will cause offending code to have a warning, but will
continue to be source and binary compatible.

This is only enabled when GLIB_VERSION_MAX_ALLOWED is 2.56 or greater.

https://bugzilla.gnome.org/show_bug.cgi?id=790697
2017-12-08 11:14:52 +00:00
Friedrich Beckmann
018b997dd2 MacOS: fix content type check vs. mime check to show folder icons
In MacOS the file selection dialog does not show folder icons.
With this fix the folder icons are shown. The bug is described
in:

https://bugzilla.gnome.org/show_bug.cgi?id=788936

This bug fix is only partial, because this fix is only the
last resort when no mime information is available.
2017-12-08 11:10:27 +00:00
Philip Withnall
62dece198b gio: Fix querying of thumbnail attributes other than thumbnail::path
The thumbnail attributes would previously only be set if thumbnail::path
was included in the query — so querying for just thumbnail::is-valid
would return no results.

This fixes the behaviour of
    gio info -a thumbnail::is-valid ./some-file.png
vs
    gio info -a thumbnail ./some-file.png

The first command would previously list nothing. The second would
previously list a thumbnail::path and thumbnail::is-valid.

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

https://bugzilla.gnome.org/show_bug.cgi?id=791325
2017-12-07 13:03:18 +00:00
Umang Jain
ed3d2d9c67 gbytes: Clarify nullability for g_bytes_unref() in docs
https://bugzilla.gnome.org/show_bug.cgi?id=791318
2017-12-07 10:27:59 +00:00
Arnaud Bonatti
2ebc78ae71 gio: Remove stray ‘<’ from gschema.dtd
The mathematical operator was making the DTD unusable.
Also, min and max can be equal with current parser.

https://bugzilla.gnome.org/show_bug.cgi?id=791267
2017-12-06 10:33:52 +00:00
1a07e35b70 gtester-report: fix range usage when running as python3 app
When using python3 as interpreter, range only takes integer arguments or
it results in errors like:

   File "/usr/bin/gtester-report", line 78, in html_indent_string
     for i in range (0, (n + 1) / 2):
 TypeError: 'float' object cannot be interpreted as an integer

https://bugzilla.gnome.org/show_bug.cgi?id=791296
2017-12-06 10:07:10 +00:00
Kukuh Syafaat
345f1c1c80 Update Indonesian translation 2017-12-05 14:42:27 +00:00
Arnaud Bonatti
0d59878bce Fix gschema.dtd regarding flags
https://bugzilla.gnome.org/show_bug.cgi?id=791235
2017-12-05 12:31:49 +00:00
Piotr Drąg
36b1132364 Remove ancient README.translators
Yo, listen up, here’s a story
About a little guy that lives in a UTF-8 world
And all day and all night and everything he sees
Is just UTF-8 like him inside and outside
UTF-8 his house with a UTF-8 little window
And a UTF-8 corvette
And everything is UTF-8 for him and himself
And everybody around
’Cause he ain’t got nobody to listen

https://bugzilla.gnome.org/show_bug.cgi?id=791221
2017-12-04 21:19:19 +01:00
Nirbheek Chauhan
c9e6270568 libcharset: Don't try to include configmake.h
It's an internal gnulib thing which will never be available while
building glib. Always expect LIBDIR and fallback to using that for
compatibility with the existing MSVC projects:
https://mail.gnome.org/archives/gtk-devel-list/2017-December/msg00000.html

https://bugzilla.gnome.org/show_bug.cgi?id=346816
2017-12-04 18:40:35 +05:30
Christian Hergert
f44472e715 gobject: fix typecasts via g_object_ref
Now that g_object_ref() propagates the parameter type to the
return value, we need to cast to ensure the result is warning
free.

https://bugzilla.gnome.org/show_bug.cgi?id=790697
2017-12-04 11:42:58 +00:00
Philip Withnall
c26aab36db gio: Fix a minor indentation problem
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2017-12-04 10:38:01 +00:00
Michael Catanzaro
18f4583653 gdbusconnection: Fix link in documentation 2017-12-03 19:22:58 -06:00
Philip Withnall
e45f99e3f6 gvariant: Clarify return docs for g_variant_get_normal_form()
Clarify that the return value may be floating, or may not be (depends
on whether the input @value was in normal form).

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

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-12-03 20:01:39 +00:00
Руслан Ижбулатов
69ea026fbc Fix a 32-bit time_t cast
Divide first, *then* cast. Otherwise a very long "now", which is
64-bit, gets truncated into a 32-bit time_t, which can't hold the
value, and turns negative more often than not.

https://bugzilla.gnome.org/show_bug.cgi?id=791128
2017-12-02 13:15:30 +00:00
Philip Withnall
532f1edd88 gmain: Clarify documentation of g_source_remove()
To try and prevent a repeat of
https://stackoverflow.com/q/47569812/2931197.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2017-12-01 10:24:36 +00:00
Philip Withnall
36f7440bb7 goutputstream: Fix pre-condition
Spotted by Izak van Langevelde.

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

https://bugzilla.gnome.org/show_bug.cgi?id=791036
2017-12-01 10:02:21 +00:00
Michael Catanzaro
7f639fd5a0 gmain: Improve documentation of GSourceFuncs
We should more clearly indicate that a source ready time will result in
a source being dispatched even if prepare and check never return TRUE.

https://bugzilla.gnome.org/show_bug.cgi?id=790948
2017-11-29 13:20:40 -06:00
Philip Withnall
4fd537b8c8 gobject: Minor typo fix in a g_critical() warning
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-29 17:51:19 +00:00
Philip Withnall
06719a86b2 docs: Drop unnecessary <!-- -->s from gtk-doc comments
Putting a <!-- --> in plural<!-- -->s was an old hack used to fix
linking the symbol with gtk-doc when gtk-doc didn’t know about plural
forms. gtk-doc does now know about plural forms, so the hack can be
removed.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-29 17:50:27 +00:00
Philip Withnall
0a2b238f7c build: Include host_machine.cpu_family() in tapset directory (Meson)
This is a corresponding change to meson.build to match commit
030efac077

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

https://bugzilla.gnome.org/show_bug.cgi?id=662802
2017-11-28 15:07:47 +00:00
Philip Withnall
90dd9ff363 gmain: Unref GSourceCallbackFuncs _before_ finalising GSource
Rather than unreffing them _after_ finalising the GSource and freeing
its struct. This fixes the case where the GSourceCallbackFuncs data
contains a pointer to the GSource, and the unref() function operates on
that pointer, e.g. by calling g_source_destroy(). This happens when
using g_source_set_dummy_callback() on a GSource, as the generated
GClosure needs to destroy the GSource when it is invalidated, which
could happen (at latest) when the GSourceCallbackFuncs.unref() function
is called during finalisation of the GSource.

By moving the GSourceCallbackFuncs.unref() invocation higher up in
g_source_unref_internal(), it becomes re-entrancy-safe for GSource
methods.

https://bugzilla.gnome.org/show_bug.cgi?id=692034
2017-11-28 14:49:26 +00:00
Carlos Garcia Campos
ed620183cb gtester: do not consider skipped tests as failures
This is happening since f591366eee, that
changed the way tests were skipped to use g_test_skip() instead of just
ignoring them. They are now reported to the log with G_TEST_RUN_SKIPPED
as result.

https://bugzilla.gnome.org/show_bug.cgi?id=790934
2017-11-28 15:36:06 +01:00
Philip Withnall
aca410c586 gobject: Add missing annotations to GValue variant methods
They were missing some (nullable) and (transfer) annotations.

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

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:29:36 +00:00
Philip Withnall
a2a4a10299 tests: Fix some minor memory leaks in gdbus-test-codegen
It’s not entirely leak-free, but it’s better than before.

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

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:28:50 +00:00
Philip Withnall
37d9b0c699 gdbusutils: Fix a memory leak in g_dbus_gvalue_to_gvariant()
g_variant_get_normal_form() doesn’t necessarily return a floating
GVariant, so we have to take, rather than sink, the ref.

This fixes a lot of leaks with gdbus-codegen-generated code.

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

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:28:50 +00:00
Tim Waugh
d35d9b7911 codegen: fix array out-param annotations
When using gdbus-codegen to produce generated code for a method with
an out parameter with a signature like 'as', make sure to include
an "(array)" annotation for that parameter.

(Reworked by Philip Withnall to improve code formatting.)

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:28:49 +00:00
Philip Withnall
2a0db6d868 inotify: Add missing commas
These were accidentally omitted from commit
748bb24985. My fault.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-28 14:25:34 +00:00
Philip Withnall
643c2d590c gdatetime: Drop a duplicate #define
It’s exactly the same as the one on the next line.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790416
2017-11-28 14:21:06 +00:00
Philip Withnall
bccc1057e3 gdatetime: Fix handling of unsupported nl_langinfo() items
If nl_langinfo() doesn’t support a particular item, it returns the empty
string. We should check for that and return NULL from
g_date_time_format() accordingly, otherwise the user could unwittingly
end up with a formatted date/time which is missing some or all of its
components.

This arose with %r in de_DE, which is unsupported by nl_langinfo()
because Germans almost never write time in 12-hour format.

Add a unit test.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790416
2017-11-28 14:21:06 +00:00
Philip Withnall
e644bfa37e gio: Add some casts for printf() formatting statbufs on Solaris
Apparently Solaris defines statbuf fields as long when Linux doesn’t, in
some cases. Cast down to the type expected by the printf() format
placeholder.

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

https://bugzilla.gnome.org/show_bug.cgi?id=749652
2017-11-28 14:17:09 +00:00
Philip Withnall
ae7895002b gnode: Eliminate implicit signed-to-unsigned integer conversion
When doing a level traverse of a GNode with depth of -1, the depth was
implicitly being converted to an unsigned integer. This worked (making
the depth limit G_MAXUINT), but was a bit mystical.

Change g_node_depth_traverse_level() to explicitly take a signed depth
and handle it appropriately.

Coverity issue: #1159465

https://bugzilla.gnome.org/show_bug.cgi?id=732003
2017-11-28 14:16:25 +00:00
Philip Withnall
b16d7fc1a7 gmountoperation: Add missing (array) annotations
Two of the vfuncs in GMountOperation need some annotations for their
element types and array sizes, otherwise g-ir-scanner comes up with
nonsense output.

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

https://bugzilla.gnome.org/show_bug.cgi?id=773980
2017-11-28 14:14:19 +00:00
Philip Withnall
181eb900d5 gdesktopappinfo: Downgrade a warning to a debug message
Bug #786580 triggered this warning to show up in the appinfo tests if
run on a machine where no terminal except xterm is installed (for
example, a build machine). Since we didn’t warn before if xterm but no
other terminals were installed, it seems reasonable to downgrade the
warning to a debug message.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790914
2017-11-28 14:12:40 +00:00
Philip Withnall
2cd26714e5 tests: Add tests to ensure g_[s]list_sort() are stable sorts
Given that we guarantee it in the API…

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

https://bugzilla.gnome.org/show_bug.cgi?id=508976
2017-11-28 14:11:30 +00:00
Philip Withnall
74cbd6c34f gslist: Document that g_slist_sort() is stable
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=508976
2017-11-28 14:11:29 +00:00
Philip Withnall
9297a596d6 gmain: Mark some ref_count variables as volatile
To make it more obvious they should exclusively be accessed with atomic
functions.

https://bugzilla.gnome.org/show_bug.cgi?id=737677
2017-11-28 14:08:59 +00:00
Philip Withnall
d73f8eec48 gmain: Make GSourceCallback thread-safe
Otherwise there is a race in finalising the GSourceCallback if one
thread is finishing off a g_main_dispatch() while another thread is
destroying the GSource which owns the GSourceCallback.

A helgrind log:

==21707== Possible data race during write of size 4 at 0x54EACB0 by
thread #12
==21707== Locks held: none
==21707==    at 0x4ECC174: g_source_callback_unref (gmain.c:1528)
==21707==    by 0x4ECD953: g_main_dispatch (gmain.c:3081)
==21707==    by 0x4ECE667: g_main_context_dispatch (gmain.c:3673)
==21707==    by 0x4ECE859: g_main_context_iterate (gmain.c:3744)
==21707==    by 0x4ECEC7F: g_main_loop_run (gmain.c:3938)
==21707==    by 0x41C197: some_thread (some-code.c:224)
==21707==
==21707== This conflicts with a previous write of size 4 by thread #5
==21707== Locks held: 1, at address 0x54CF320
==21707==    at 0x4ECC174: g_source_callback_unref (gmain.c:1528)
==21707==    by 0x4ECB86F: g_source_destroy_internal (gmain.c:1178)
==21707==    by 0x4ECB9D4: g_source_destroy (gmain.c:1227)
==21707==    by 0x41CF09: some_other_thread (some-other-code.c:410)

https://bugzilla.gnome.org/show_bug.cgi?id=737677
2017-11-28 14:08:58 +00:00