Commit Graph

216 Commits

Author SHA1 Message Date
Matthew Leeds
1f49c5aaeb gio: Make minor docs improvements
This commit changes a comment in _g_dbus_worker_do_read_cb() to be
slightly more useful. At least in my experience debugging an
intermittent unit test failure in another project, this failure
condition occurred because although g_test_dbus_down() ensures that the
session GDBusConnection has exit-on-close set to FALSE before killing
its dbus-daemon, there was still a GDBusConnection on the system bus
which hit this failed read code path, because we had
DBUS_SYSTEM_BUS_ADDRESS set to the address of the #GTestDBus daemon, to
appease libudisks.

Also, make a few other minor improvements to the docs.
2019-06-25 11:11:33 -07:00
Christian Hergert
22ba4411cc gio: remove use of generic marshaller from GIO objects
Using the generic marshaller has drawbacks beyond performance. One such
drawback is that it breaks the stack unwinding from the Linux kernel due
to having unsufficient data to walk past ffi_call_unixt64. That means that
performance profiling by application developers looks grouped among
seemingly unrelated code paths.

While we can't fix the kernel unwinding here, we can provide proper
c_marshallers and va_marshallers for objects within Gio so that
performance profiling of applications is more reliable.

Related to GNOME/Initiatives#10
2019-06-17 16:29:09 -07: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
5cc6942eab gdbusconnection: Add missing (nullable) annotation to get_unique_name()
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1594
2018-11-15 09:42:33 +00:00
Philip Withnall
c63d37fdc2 docs: Clarify return/error behaviour of D-Bus signal subscriptions
Based on a patch by David Sommerseth, from
https://gitlab.gnome.org/GNOME/glib/merge_requests/285/.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-13 12:44:34 +00:00
Simon McVittie
e0a8df12ef Spelling: Fix spelling of "similarly"
Detected by Debian's Lintian tool.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-25 14:35:13 +01:00
Philip Withnall
034bbfd873 gdbusconnection: Drop an outdated TODO comment
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/340
2018-07-10 19:16:35 +02:00
Piotr Drąg
d9fc99256e Use Unicode typography in new translatable strings
See https://developer.gnome.org/hig/stable/typography.html
2018-06-25 16:51:00 +02:00
Piotr Drąg
b974cccdaf Revert "Partially revert 10c490cdfe3ae042f747bd00f787492e2bdb7ed0"
This reverts commit 2d56c49b10.
2018-06-08 16:15:54 +02:00
Philip Withnall
29f4eacebe gdbusconnection: Fix a typo in the documentation for close_sync()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-19 16:36:16 +01:00
Simon McVittie
3d50691a30 g_test_dbus_down: Ensure next test does not use old connection
There's a race condition somewhere in GTestDBus that can result in
the next test being started at a time when g_bus_get() would still
return the connection that is in the process of closing. This can
be reproduced reasonably reliably by running the gapplication test
10K times in a loop.

Instead of relying on waiting for the weak reference to be released,
we can force the issue by clearing it.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=768996
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=894677
2018-04-10 11:22:41 +01:00
Philip Withnall
0664b61782 gdbusconnection: Fix error in g_dbus_connection_emit_signal() docs
It incorrectly said that an error could only be returned if the GVariant
was incorrect for the D-Bus API, but that’s not true: an error will also
be returned if you call it on a closed GDBusConnection.

Clarify that, and mention the actual error codes which are returned.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-02-15 16:42:26 +00:00
Philip Withnall
c4ad10fede docs: Mention D-Bus reply types are tuples
The g_dbus_connection_call() documentation doesn’t make it clear that
the reply type is always a tuple.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-01-09 15:17:02 +00:00
Michael Catanzaro
18f4583653 gdbusconnection: Fix link in documentation 2017-12-03 19:22:58 -06:00
Stefan Sauer
2812219adb docs: add missing '*' chars at start of doc-comments 2017-11-12 16:36:16 +01:00
Philip Withnall
3eacec1587 Use hash tables as sets in various places
Where we were already treating GHashTables as sets, modify them to use
the set-specific APIs g_hash_table_add() and g_hash_table_contains(), to
make that usage more obvious and less prone to being broken.

Heavily based on patches by Garrett Regier <garrettregier@gmail.com>.

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

https://bugzilla.gnome.org/show_bug.cgi?id=749371
2017-10-26 12:27:17 +01:00
Matthias Clasen
f39024038f Disambiguate source names
This makes debugging more pleasant.
2017-06-28 19:50:57 -04:00
Sébastien Wilmet
3bf4a720c3 gio/: LGPLv2+ -> LGPLv2.1+
Sub-directories inside gio/ already processed in a previous commit:
- fam/
- gdbus-2.0/ (which contains only codegen/)
- gvdb/
- inotify/
- tests/
- win32/
- xdgmime/

Other sub-directories inside gio/:
- completion/: no license headers
- kqueue/: not LGPL, BSD-style license

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Lars Uebernickel
0751ccd315 gdbus: fix use-after-free
g_dbus_connection_call_internal() accesses the user data it passes to
g_dbus_connection_send_message_with_reply() after the call. That data
might be freed already in the case that the callback is called
immediately.

Fix this by removing the 'serial' field from the user data altogether
and fetch the serial from the message in the callback.

https://bugzilla.gnome.org/show_bug.cgi?id=748263
2017-05-12 14:43:22 -04:00
Philip Withnall
88ad0dab21 gdbusconnection: Add some comments about object ownership
Some annotations I made while trying to debug bug #781847. They
introduce no behavioural changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-04-28 12:06:25 +01:00
Ole André Vadla Ravnås
005dfeacba gdbus: fix false positive g_warning() in remove_filter()
The GDBus thread might be holding a ref while requesting to remove the
filter.

https://bugzilla.gnome.org/show_bug.cgi?id=779409
2017-04-08 01:13:06 -04:00
INSUN PYO
07465176da gdbus: Initialize types at async entrypoints
This isn't a comprehensive fix, but should cover a lot of cases
for GDBus.

https://bugzilla.gnome.org/show_bug.cgi?id=674885
2017-03-27 09:42:47 -04:00
Piotr Drąg
e9fe8868a7 Use single non-Unicode quotation marks in a new translatable message
Actually, Unicode changes to this file got reverted in
2d56c49b10. Also, there is
"No such interface '%s'" string already, so we avoid
breaking the string freeze.
2017-03-14 14:51:49 +01:00
Piotr Drąg
bb93f3a4aa Use consistent quotation marks in a new translatable message
Double quotation marks are used everywhere else in glib, as per
<https://developer.gnome.org/hig/stable/typography.html>.
2017-03-14 14:45:48 +01:00
Philip Withnall
ff327ba2d7 gdbusmessage: Add missing G_GNUC_PRINTF attribute
This highlighted a bug in GDBusConnection, where an interface name was
not included in a message referring to it.

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

https://bugzilla.gnome.org/show_bug.cgi?id=780032
2017-03-14 12:57:32 +00:00
Philip Withnall
78fba90f65 docs: Add links to D-Bus specification for D-Bus address format
In an attempt to clarify the format a little.
2017-02-08 15:06:23 +00:00
Fabrice Bellet
b1f14143e5 gdbus: make gdbusconnection ids thread-safe
To prevent a race where these global static counters can be
incremented by two threads concurrently.

https://bugzilla.gnome.org/show_bug.cgi?id=778096
2017-02-05 14:25:05 +01:00
Christian Hergert
18a33f72db introspection: use (nullable) or (optional) instead of (allow-none)
If we have an input parameter (or return value) we need to use (nullable).
However, if it is an (inout) or (out) parameter, (optional) is sufficient.

It looks like (nullable) could be used for everything according to the
Annotation documentation, but (optional) is more specific.
2016-11-22 14:14:37 -08:00
Matthias Clasen
2d56c49b10 Partially revert 10c490cdfe
This commit broke some tests, and I don't have the time
to fix up all the expected output, so I'll revert the changes
to the affected files for now.

This needs to be redone with the necessary test fixes.
2016-10-24 10:21:59 -04:00
Piotr Drąg
10c490cdfe Use Unicode in translatable strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772221
2016-10-12 21:30:42 +02:00
Philip Withnall
3613b7a366 gio: Add source tags to various GTasks constructed in GLib
This makes them easier to identify when debugging and profiling.

This patch was somewhat less than interesting to write.

https://bugzilla.gnome.org/show_bug.cgi?id=767765
2016-06-29 15:16:52 +01:00
Allison Ryan Lortie
b54acf513d GDBusConnection: use uint for bitshifts
"1 << 31" is not well-defined, do use "1u << 31" instead.

https://bugzilla.gnome.org/show_bug.cgi?id=762748
2016-03-01 10:34:07 -05:00
Philip Withnall
ac05ad55fa gdbusconnection: Add missing (nullable) to get_peer_credentials()
Since Colin mentioned it on gir-devel-list.
2015-10-06 07:59:19 +01:00
Matthias Clasen
9acd0ddbf3 gio: Intern all signal names beforehand
This avoids pointless copying of static strings.
2015-09-12 11:13:45 -04:00
Dan Winship
7da3922d05 gdbus: fix race condition in connection filter freeing
If you called g_dbus_connection_remove_filter() on a filter while it
was running (or about to be run) in another thread, its GDestroyNotify
would be run immediately, potentially causing the filter thread to
crash.

Fix this by refcounting the filters, and using the existing mechanism
for running a GDestroyNotify in another thread in the case where the
the gdbus thread is the one that frees it.

Also, add a bit of documentation explaining this (and add a related
clarification to g_dbus_connection_signal_subscribe()).

https://bugzilla.gnome.org/show_bug.cgi?id=704568
2015-08-24 16:30:05 -04:00
Janusz Lewandowski
5d014a802a Add a g_dbus_connection_register_object_with_closures function
This is a binding-friendly version of g_dbus_connection_register_object.
Based on a patch by Martin Pitt and the code of g_bus_watch_name_with_closures.

https://bugzilla.gnome.org/show_bug.cgi?id=656325
2015-08-18 16:41:12 -04:00
Colin Walters
66bc9660c4 gdbusconnection: Don't g_printerr() when exiting
exit-on-close for a DBus connection is a completely normal thing.  On
a regular GNOME login, gdm retains the X server, but terminates the
session login bus and associated helpers like gnome-settings-dameon,
the a11y tools, etc.

I've seen several downstream reports of confusion as to what these
apparent error messages mean in the system log.  It doesn't help
that they're so obtuse.

We're also printing them to stderr, when this is not an error.

The reason this was introduced is presumably some people were confused
as to why their process exited when the system bus did.  But the
solution for that I believe is documentation, not printing stuff to
everyone's system log in normal operation.

https://bugzilla.gnome.org/show_bug.cgi?id=742386
2015-08-06 08:51:02 -04:00
Arun Raghavan
be7de8a7fd gdbusconnection: Fix signal subscription documentation
https://bugzilla.gnome.org/show_bug.cgi?id=752656
2015-07-21 15:20:23 -04:00
Jan Safranek
b31a873fb3 GDBus: Add new call flag to allow interactive authorization
DBus has recently introduced new message flag
DBUS_HEADER_FLAG_ALLOW_INTERACTIVE_AUTHORIZATION, which tells that
caller is willing to wait for unspecified amount of time for the call
to return, as the service may perform interactive authorization (e.g.
using polkit).

https://bugzilla.gnome.org/show_bug.cgi?id=739616
2015-06-05 14:35:34 -04:00
Marc-André Lureau
41acf970ac gdbus: fix out-of-bound array access
In path_rule_matches(), the given paths may be of 0-length. Do not
access memory before the array in those case. This is for example
triggered by:

test_match_rule (con, G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH, "/", "", FALSE);

in test_connection_signal_match_rules().

This bug was found thanks to GCC AddressSanitizer.

https://bugzilla.gnome.org/show_bug.cgi?id=745745
2015-04-21 22:54:34 +02:00
Dan Winship
7e8d4145af gdbus: fix deadlock on message cancel/timeout
The gdbus GTask port introduced a deadlock because some code had been
using g_simple_async_result_complete_in_idle() to ensure that the
callback didn't run until after a mutex was unlocked, but in the gtask
version, the callback was being run immediately. Fix it to drop the
mutex before calling g_task_return*(). Also, tweak
tests/gdbus-connection to test this.

https://bugzilla.gnome.org/show_bug.cgi?id=747349
2015-04-06 12:22:07 -04:00
Dan Winship
f10b6550ff gio: (belatedly) port gdbus from GSimpleAsyncResult to GTask
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2015-04-04 10:16:45 -04:00
Michael Catanzaro
02c6e908d7 Fix typo 2014-07-09 10:49:39 -05:00
Bastien Nocera
8792609e15 gio: Add names to idles and timeouts
This isn't too useful for some of the "return result in idle"
functions, but it's better than nothing.

https://bugzilla.gnome.org/show_bug.cgi?id=726872
2014-03-27 12:53:00 +01:00
Matthias Clasen
a03cee3b27 Convert remaining examples to links 2014-02-08 17:52:21 -05:00
Matthias Clasen
e7fd3de86d Eradicate links and xrefs
These are all replaced by markdown ref links.
2014-02-08 12:26:56 -05:00
Matthias Clasen
3232425785 Docs: replace <literal> by ` 2014-02-06 08:07:16 -05:00
Matthias Clasen
ce87d6420c Don't use the quote tag
It was only used in two places, and we can easily do without.
2014-02-01 21:19:00 -05:00
Matthias Clasen
adf892e96a Annotate all examples with their language
The C ones, at least.
2014-02-01 15:11:49 -05:00
Matthias Clasen
42cf80780b Docs: Big entity cleanup
Strip lots of entity use from |[ ]| examples (which are now
implicit CDATA). Also remove many redundant uses of <!-- -->.
2014-02-01 12:00:30 -05:00