Commit Graph

6111 Commits

Author SHA1 Message Date
Nirbheek Chauhan
b01bbe6536 Merge branch '1767-scan-build-fixes' into 'master'
Various small scan-build fixes

See merge request GNOME/glib!1088
2019-09-13 12:37:37 +00:00
Sebastian Dröge
6d4738ed22 Merge branch '1875-xdgmimecache-robustness' into 'master'
xdgmime: Prevent infinite loops from badly-formed MIME registrations

Closes #1875

See merge request GNOME/glib!1085
2019-09-13 11:42:55 +00:00
Philip Withnall
adf96047f4 xdgmime: Prevent infinite loops from badly-formed MIME registrations
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1875
2019-09-13 12:13:49 +01:00
Philip Withnall
475b9b5f7c tests: Add tests for GFileInfo modification time
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-05 17:13:08 +01:00
Philip Withnall
b99cdf56dc tests: Use g_assert_*() rather than g_assert() in g-file-info test
They provide more detailed failure messages, and aren’t compiled out
when building with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-05 17:13:08 +01:00
Christian Hergert
b933b0f369 fileinfo: ignore USEC if not available
When future porting deprecated code to use
g_file_info_get_modification_date_time() we risk a number of breakages
because the current implementation also requires the additional use of
G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC. This handles that situation gracefully
and returns a GDateTime with less precision.

Applications that want the additional precision, are already using the
additional attribute.

(Minor tweaks by Philip Withnall.)
2019-09-05 17:13:08 +01:00
Philip Withnall
8fe58ffe12 gdbusdaemon: Fix unused variable warning
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1767
2019-09-05 14:17:08 +01:00
Philip Withnall
d99653f6fe gdbusdaemon: Add sanity checks on name refcounting
This should make the code a bit easier to reason about, and squash some
static analysis warnings.

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

Helps: #1767
2019-09-05 14:17:05 +01:00
Philip Withnall
0b4162e714 build: Disable dtrace probes under static analysis
The macros for the probes confuse the static analyser, and are often
called with arguments which the analyser things shouldn’t be used any
more (for example, the address of a block of memory which has just been
freed).

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

Helps: #1767
2019-09-05 14:16:58 +01:00
Philip Withnall
18a232be89 glib: Various minor scan-build fixes
These squash various warnings from `scan-build`. None of them are
legitimate bugs, but some of them do improve code readability a bit.

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

Helps: #1767
2019-09-05 13:51:27 +01:00
Sebastian Dröge
daa308dd6e Merge branch '487-ci-memcheck' into 'master'
Add CI job for running tests under Valgrind

Closes #487

See merge request GNOME/glib!169
2019-09-02 13:52:35 +00:00
Philip Withnall
39052a1cfc tests: Fix some minor memory leaks in tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-09-02 14:16:33 +01:00
Emmanuele Bassi
a0cbb32680 Merge branch '1309-delayed-settings-changed' into 'master'
gsettings: Add missing changed() call to delayed settings backend

Closes #1309

See merge request GNOME/glib!1046
2019-09-02 11:14:59 +00:00
Nirbheek Chauhan
9456cec53e Merge branch 'wip/lantw/meson-move-libdl_dep-to-the-top-level' into 'master'
meson: Move libdl_dep to the top level

See merge request GNOME/glib!1071
2019-08-29 18:45:36 +00:00
Ting-Wei Lan
fe3c16608a meson: Move libdl_dep to the top level
Instead of letting each directory to find its way to link with libdl,
it is easier to put the check in the top level, so its result can be
used by all directories.

It is a follow-up of https://gitlab.gnome.org/GNOME/glib/merge_requests/810.
2019-08-29 23:25:40 +08:00
Mihai Moldovan
bd4c16b356 gio: actually install and reference gnativesocketaddress.h.
The header file was installed when building using autotools, but was
inadvertently omitted in the meson targets.

Luckily, ABI is not impacted, since gnativesocketaddress.c was always
compiled and linked into libgio.

Fixes: #1854
2019-08-29 14:32:55 +02:00
Mihai Moldovan
5e18888a94 gio: Housekeeping: sync up and sort gio_{sources,headers} lists 2019-08-29 14:32:55 +02:00
Sergio Costas
09e094a676 gsubprocesslauncher.c: fix documentation
The gobject introspection comments have a reference to an incorrect
class: they have, as 'self', the GSubprocess class instead of
GSubprocessLauncher.

This patch fixes this.
2019-08-29 00:15:03 +02:00
Sebastian Dröge
d3ae4b1d30 GSettingsBackend - Fix thread-safety during destruction of GSettings instances while notifications are emitted
g_settings_backend_watch() uses a weak notify for keeping track of
the target. There's an explanation why this is supposed to be safe but
that explanation is wrong.

The following could happen before:

1. We have the target stored in the watch list
2. The last reference to the target is dropped in thread A and we end up
   in g_settings_backend_watch_weak_notify() right before the mutex
3. g_settings_backend_dispatch_signal() is called from another thread B
   and gets the mutex before 2.
4. g_weak_ref_init() is called on the target from thread B, which at
   this point has a reference count of exactly one (see g_object_unref()
   where it calls the weak notifies)
5. Thread A continues at 3. and drops the last reference and destroys
   the object. Now the GWeakRef from 4. points to a destroyed object. Note
   that GWeakRefs would be cleared before the weak notifies are called
6. At some later point another thread g_weak_ref_get() is called by
   g_settings_backend_invoke_closure() and accesses an already destroyed
   object with refcount 0 from the GWeakRef created in 4. by thread B (or
   worse, already freed memory that was reused).

Solve this by actually storing a GWeakRef of the target in the watch
list and only access the target behind it via the GWeakRef API, and then
pass a strong reference to the notification dispatch code.

The weak notify is only used to remove the (potentially with empty
GWeakRef) target from the list of watches and the only place that
compares the target by pointer instead of going through the GWeakRef
API.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1870
2019-08-27 11:09:08 +03:00
Philip Withnall
562ac9de43 gwinhttpvfs: Fall back to wrapped VFS if creating a HTTP file fails
If we fail to create a GWinhttpFile for a URI (for example, because it’s
an invalid URI or is badly encoded), don’t just return NULL. Instead,
fall back to the wrapped VFS which might be able to handle it instead.

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

Fixes: #1819
2019-08-27 08:21:26 +03:00
Philip Withnall
4b0421a730 gwinhttpfile: Document constructor as potentially returning NULL
It can return NULL if the URI was badly encoded or couldn’t be handled
by Windows’ API.

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

Helps: #1819
2019-08-27 08:21:26 +03:00
Philip Withnall
e24503a8e9 gvfs: Add an assertion to check that get_file_for_uri() is never NULL
It cannot return a NULL value, as none of its callers have error
handlng. Add an assertion to check the values returned by the VFS
implementations.

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

Helps: #1819
2019-08-27 08:21:25 +03:00
Philip Withnall
833c24f45a gvolumemonitor: Use GIOModule methods for getting default type
This fixes use of `GIO_USE_VOLUME_MONITOR=help`, and simplifies the
code. The reason this wasn’t used already seems to just be because it
was missed when `_g_io_module_get_default_type()` was introduced in
2013. The previous `get_default_native_class()` code in
`gunionvolumemonitor.c` was introduced in 2007.

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

Closes: #1881
2019-08-26 13:41:26 +03:00
Дилян Палаузов
512655aa12 minor typos in the documentation (a/an) 2019-08-24 19:14:05 +00:00
Philip Withnall
c178c9734c Merge branch 'static_analysis_2_40_patches' into 'master'
Static analysis 2 40 patches

Closes #905

See merge request GNOME/glib!1042
2019-08-24 14:22:38 +00:00
Colin Walters
649faee0e6 gio/gnetworkmonitornetlink.c: Add NULL check on dest before using it 2019-08-24 15:55:49 +02:00
Colin Walters
f731dd376c gio/glib-compile-resources.c: Unref objects in error path 2019-08-24 15:44:59 +02:00
Philip Withnall
3c9ff2712f Merge branch 'override' into 'master'
Meson: Override glib-compile-resources/schemas

See merge request GNOME/glib!1037
2019-08-23 11:30:46 +00:00
Philip Withnall
13e947d8cf Merge branch '1867-en-gb-isms' into 'master'
glib-compile-schemas: Fix some minor en_GB-isms in translatable strings

Closes #1867

See merge request GNOME/glib!1038
2019-08-21 17:53:43 +00:00
Philip Withnall
63abca2963 gsettings: Add missing changed() call to delayed settings backend
When resetting a key in the delayed settings backend,
g_settings_backend_changed() was not called to notify the backend of
the change.

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

Fixes: #1309
2019-08-21 20:08:04 +03:00
Philip Withnall
87a71fe4d3 tests: Add a test for peer-to-peer GDBusProxy usage with a bus name
This is a regression test for the fix in !554.

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

Fixes: #1620
2019-08-21 19:49:06 +03:00
Philip Withnall
a01983f94c tests: Add a test for g_dbus_connection_get_flags()
It was added in !554 but never had a unit test.

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

Helps: #1620
2019-08-21 19:49:06 +03:00
Philip Withnall
9fc745db07 tests: Drop unnecessary usage of g_test_bug_base("")
See the previous commit.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-08-21 19:42:27 +03:00
Philip Withnall
389b1820f2 glib-compile-schemas: Fix some minor en_GB-isms in translatable strings
Spotted by Bruce Cowan.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Fixes: #1867
2019-08-14 10:38:23 +02:00
Xavier Claessens
fdcdd5c5b4 Meson: Override glib-compile-resources/schemas
This fix build error for projects that use gnome.compile_resources()
when glib is built as a subproject and not installed on the build
machine.

Note that this is not working for cross compilation cases, because it
would require to compile everything twice (for host and build machines).
A better solution would be to rewrite those tools in python. See #1859.
2019-08-13 08:52:50 -04:00
Philip Withnall
84738f7e80 Merge branch 'wip/hadess/gnetworkmonitor-nm-fixups' into 'master'
gnetworkmonitornm fixups

See merge request GNOME/glib!1016
2019-07-29 15:47:55 +00:00
Bastien Nocera
f299886f1f gnetworkmonitornm: Remove double-space 2019-07-29 17:28:01 +02:00
Bastien Nocera
109f247039 gnetworkmonitornm: Arguments to g-signal's callback are const 2019-07-29 17:28:01 +02:00
Bastien Nocera
7d3ecce346 gnetworkmonitornm: Disconnect g-signal from proxy
So that we're sure never to receive a signal if something is keeping the
proxy alive.
2019-07-29 17:28:01 +02:00
Bastien Nocera
ef1d5b5ee0 gnetworkmonitornm: Remove unneeded ";" in G_DEFINE_INTERFACE_WITH_CODE 2019-07-29 17:28:01 +02:00
Philip Withnall
86ba1b37bd Merge branch 'application-free-remote-actions' into 'master'
gapplication: Fix a leaking GRemoteActionGroup member

See merge request GNOME/glib!1011
2019-07-29 13:21:51 +00:00
Philip Withnall
96c74fd0e6 win32: Stop using deprecated GTimeVal in GWinHttpFile
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1438
2019-07-29 12:27:29 +01:00
Philip Withnall
de25be72f0 tests: Stop using deprecated g_get_current_time()
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1438
2019-07-29 12:27:29 +01:00
Philip Withnall
161654681f gfileinfo: Stop using deprecated GTimeVal
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1438
2019-07-29 12:27:29 +01:00
Philip Withnall
def5db23a3 gdbusutils: Stop using g_get_current_time()
It is deprecated.

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

Helps: #1438
2019-07-29 12:27:29 +01:00
Philip Withnall
4faf4fcfaa gfileinfo: Deprecate g_file_info_{get,set}_modification_time()
They use the deprecated GTimeVal type, which is not year 2038 safe, so
have to be deprecated.

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

Helps: #1438
2019-07-29 12:27:29 +01:00
Philip Withnall
d166a55c64 gfileinfo: Add g_file_info_{get,set}_modification_date_time() APIs
These are alternatives to g_file_info_{get,set}_modification_time(),
which will soon be deprecated due to using the deprecated GTimeVal
type, which is not year 2038 safe.

The new APIs take a GDateTime instead.

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

Helps: #1438
2019-07-29 12:27:29 +01:00
Philip Withnall
8f385b8cf5 Merge branch 'master' into 'master'
windows: fix multicast socket binding to specific network interfaces

Closes #1635

See merge request GNOME/glib!887
2019-07-29 11:10:40 +00:00
Philip Withnall
0f131857ba gapplication: Fix a leaking GRemoteActionGroup member
Fix prompted by Ting-Wei Lan’s similar fix for the inactivity timeout
(!1009).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-07-29 10:49:45 +01:00
Ting-Wei Lan
0ed8605079 gapplication: remove inactivity_timeout source on finalize
The event source used to handle inactivity_timeout doesn't hold a
reference on the application. Therefore, it is possible for callback
function of the event source to run after the application has been
freed, leading to use-after-free problem. To avoid the problem, we
should remove the event source before the application is freed.

This should fix SIGBUS crash of gio/tests/gapplication on FreeBSD.
https://gitlab.gnome.org/GNOME/glib/issues/1846#note_566550
2019-07-27 15:28:23 +08:00