2015 Commits

Author SHA1 Message Date
Simon McVittie
d98aceab09 GDBusWorker: tolerate read errors while closing
My previous fix for GNOME#662100 was incomplete: it seems that with some
timings, the stream can be closed with an async read in-flight. This
can make the read fail immediately with G_IO_ERROR_CLOSED instead of
becoming cancelled.

This happens reliably on an embedded device, and rarely on my laptop;
repeating the test 100 times in quick succession reliably reproduces
the bug on my laptop.

It seems as though what we really want is to ignore read errors, once
we've established that we want to close the connection anyway - this
means that after asking to close, you're immune to exit-on-close,
which seems like a good rule.

An additional subtlety is that continuing to read after we know we
want to close is still required, otherwise we'll never emit ::closed.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-11-11 16:06:30 +00:00
Simon McVittie
8a7bf8c283 GDBusWorker: debug on read errors if transport debugging is enabled
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-11-11 16:06:27 +00:00
Simon McVittie
5949eb9806 gdbus-exit-on-close test: don't leak a variant
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-11-11 16:06:23 +00:00
Simon McVittie
0ed2e786cc gdbus-exit-on-close test: optionally be more verbose for debugging
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-11-11 16:06:18 +00:00
Simon McVittie
19d1db095d GDBusWorker: backport explanatory comment about G_IO_ERROR_CANCELLED from 2.30
This was mistakenly omitted from the 2.28 version.

(cherry picked from commit d65b80fb547ef3eed80ae970f858e7d110d90b40)

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2011-11-11 16:06:13 +00:00
Tim-Philipp Müller
e72314f369 tests: fix glib_translations_work()
If setlocale() to our test locale fails, translations
won't work either.

https://bugzilla.gnome.org/show_bug.cgi?id=654017
2011-10-18 17:08:13 +01:00
Simon McVittie
21b10392a3 gdbus-non-socket test: avoid use of a GMainContext across a fork
See https://bugzilla.gnome.org/show_bug.cgi?id=658999 for why this would
be bad.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-10-18 16:41:17 +01:00
Simon McVittie
9bf965e81f gdbus-exit-on-close test: cover more possibilities
We didn't previously test anything except the implicit default of TRUE.
Now we test implicit TRUE, explicit TRUE, explicit FALSE, and
disconnecting at the local end (which regressed while fixing Bug #651268).

Also avoid some questionable use of a main context, which fell foul of
Bug #658999 and caused this test to be disabled in master.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-10-18 16:41:15 +01:00
Simon McVittie
ac2c49f313 GDBusWorker: if a read was cancelled it means we closed the connection
This was a regression caused by my previous work on GDBusWorker thread-safety
(Bug #651268). The symptom is that if you disconnect a GDBusConnection
locally, the default implementation of GDBusConnection::closed
terminates your process, even though it shouldn't do that for
locally-closed connections; this is because GDBusWorker didn't think a
cancelled read was a local close.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-10-18 16:41:12 +01:00
Simon McVittie
f021522b96 _g_dbus_worker_new: ref worker until after _g_dbus_worker_thread_begin_func
Otherwise, if the caller of _g_dbus_worker_new immediately unrefs the
worker, calling _g_dbus_worker_thread_begin_func in the worker thread
could be a use-after-free.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 12:07:04 -04:00
Simon McVittie
e128c045eb GDBusWorker: as a precaution, access 'stopped' boolean atomically
This member is written in _g_dbus_worker_stop from arbitrary threads, and
read by the worker thread, so it should be accessed atomically.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 12:07:04 -04:00
Simon McVittie
407b4cf8c4 Regression test for closing a stream, slowly, while a message is queued
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 12:07:04 -04:00
Simon McVittie
2e1b3cd90b GDBusWorker: annotate more functions with lock/pending state
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 12:07:04 -04:00
Simon McVittie
c9282849b6 GDBusConnection: delegate to the worker to close the stream
We can't safely close the output part of the I/O stream until any
pending write or flush has been completed. In the worst case, this could
lead to an assertion failure in the worker (when the close wins the
race) or not closing the stream at all (when the write wins the race).

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 12:07:04 -04:00
Simon McVittie
7bbc7727d4 GDBusWorker: combine num_writes_pending with flush_pending
num_writes_pending was a counter, but it only took values 0 or 1, so make
it a boolean: it would never make sense to be trying to write out two
messages at the same time (they'd get interleaved).

Similarly, we can never be writing and flushing at the same time (that'd
mean we were flushing halfway through a message, which would be pointless)
so combine it with flush_pending too, calling the result output_pending.

Also assert that it takes the expected value whenever we change it,
and document the locking discipline used for it, including a subtle
case in write_message_in_idle_cb where it's not obvious at first glance
why we don't need the lock.

(Having the combined boolean at the top of the block of write-related
struct members improves struct packing on 64-bit platforms, by packing
read_num_ancillary_messages and output_pending into one word.)

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=651268
Bug-NB: NB#271520
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 12:07:04 -04:00
Josselin Mouette
8091e2cadb Fix default setting generation in g_desktop_app_info_set_as_last_used
* Do not ignore the system default
 * Do not exclude the last used being set from the default list

This fixes the default applications dialog in control-center.

https://bugzilla.gnome.org/show_bug.cgi?id=658188
2011-09-10 08:30:27 +02:00
David Zeuthen
012b95fe48 GDBusConnection: Only apply exit-on-closed semantics if properly initialized
Otherwise there is no point in gracefully handling the error...

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-01 12:07:35 -04:00
Nicolas Dufresne
d4433e6ae8 Added TLS PEM parser unit test 2011-07-27 16:20:14 -04:00
Nicolas Dufresne
3a7fad0313 Rework PEM parsing to not be order dependent
Some valid PEM file would not work because the private key was put
before the certificate.
2011-07-27 16:20:08 -04:00
Murray Cumming
38220cd31d GDBusServer: Documentation: Improvements.
Provide a fuller description and lead people away if they arrived
here just looking for a way to provide a regular D-Bus service.
2011-06-15 09:35:53 +02:00
Javier Jardón
a635e3be65 gconverter: Improve cross-references 2011-06-08 16:30:06 +01:00
Chun-wei Fan
34f35595c8 Update the year in the *.rc.in files
Sorry this change came a bit late...
2011-06-07 08:53:11 +08:00
Matthias Clasen
4bafdccc63 Expand content type docs slighly 2011-06-05 13:20:51 -04:00
muralis
16d5f448d8 gthreadedresolver: fix hang on g_thread_pool_push() failure
In resolve_sync function in gthreadedresolver.c, if g_thread_pool_push
fails due to thread creation failure, we are just simply appending the
data to the queue of work to do. After the failure, we might wait
indefinitely in g_cond_wait. In case of g_thread_pool_push failure,
propagate the error so that this function does not blocks forever in
case of failure.

https://bugzilla.gnome.org/show_bug.cgi?id=651034
2011-06-05 13:19:44 -04:00
Neil Roberts
a94f498e27 gsocket: Fix some cases of returning error without setting *error
g_socket_shutdown and g_socket_close were calling check_socket with a
NULL error parameter so any errors wouldn't get propagated up.

https://bugzilla.gnome.org/show_bug.cgi?id=651327
2011-06-05 13:18:33 -04:00
Neil Roberts
26bf8c67ba gsocket: Fix the error message for a failed g_socket_shutdown
The GError message for g_socket_shutdown was reporting that it was
"Unable to create socket" which is presumably a cut-and-paste bug.

https://bugzilla.gnome.org/show_bug.cgi?id=651327
2011-06-05 13:18:24 -04:00
Matthias Clasen
a83581a4f0 glib-compile-schemas: write informational messages to stdout
The fact that we return 0 here makes it clear that this
is not considered an error, so it makes sense to not
write these messages to stderr.
Proposed by Antoine Jacoutot,
https://bugzilla.gnome.org/show_bug.cgi?id=650882
2011-06-05 13:13:46 -04:00
Richard Hughes
b8d26cc4cb Correct the annotation for g_file_enumerator_get_container()
We don't ref the returned object, and alex has verified the gvfs implementation.
2011-06-05 13:11:27 -04:00
Chun-wei Fan
be4f4563c7 Fix unconditional unistd.h inclusion
Cherry-pick from commit 3c94299b0ff1c8e1b0b06bedd73b1b725e631d8a
in master.

This will close Bug 644905.
2011-06-01 08:12:45 +08:00
Ryan Lortie
89908908d5 GApplication: fix remote action states
Fix up remote_action_info_new_from_iter() to do its job better and use
it from all places that it's appropriate.

Closes #650236.
2011-05-20 23:50:55 -04:00
Ryan Lortie
2ab5d96fa6 Fix gsettings tool string handling
There are some bugs caused by the way that gsettings-tool currently
attempts to help the user when they leave the quotes off of a string
value that they are setting.

Simplify the code to make it more robust and add some comments about why
it should be done this way.

https://bugzilla.gnome.org/show_bug.cgi?id=649915
2011-05-20 23:42:22 -04:00
Alexander Larsson
c7271d2184 GFilterInputStream: close-base-stream should not be construct-only
This is a runtime changable property (by the methods for it), must
be a cut and paste error.
2011-05-20 23:34:13 -04:00
Matthias Clasen
486e6d3eb4 Fix up some harmless FALSE <> NULL confusions
Reported in bug 643134.
2011-05-20 23:31:12 -04:00
Michael Terry
859c8f7ed7 Don't ignore SUPPORTS_STARTUP_NOTIFICATION for commandline GAppInfos
https://bugzilla.gnome.org/show_bug.cgi?id=648416
2011-05-20 23:30:15 -04:00
Martin Pitt
5deeb94970 [gi] Add missing allow-none annotations to GDBusConnection
Cherrypicked from master commit 21c2291.
2011-05-08 23:10:37 +02:00
Chun-wei Fan
2a1514a29f Bug 643161: VS 2010 Project files (autotools)
Added rules in GLib, GIO and GObject to
expand the respective project files and templates
during "make dist" so that the source file listing
is up-to-date in releases, so to simplify their maintenance.
2011-04-22 19:09:38 +08:00
Ryan Lortie
8c24ea5f49 builder: do not include <unistd.h> on win32
Spotted by Kean Johnston <kean.johnston@gmail.com>.

https://mail.gnome.org/archives/gtk-devel-list/2011-April/msg00010.html
2011-04-15 09:33:12 -04:00
Michael Kuhn
c06be20515 Bug 637561 - Crash when using G_DBUS_SERVER_FLAGS_RUN_IN_THREAD
https://bugzilla.gnome.org/show_bug.cgi?id=637561

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-15 06:26:55 -04:00
Simon McVittie
eb70e54370 /gdbus/message-serialize-invalid test: be compatible with D-Bus 1.4.8
Older versions of libdbus would let you construct an invalid
DBusMessage, but that's a bug, which will be fixed in 1.4.8/1.5.0.
Instead, construct a valid message of the same length, then replace
substrings in the serialized blob with their invalid counterparts.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-15 06:26:36 -04:00
David Zeuthen
fc80ec9d0c GDBus: If an authentication method fail, don't give up, just try the next one
This problem was reported in bug 647602.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-14 10:14:02 -04:00
David Zeuthen
69c4e81d0a GDBus: Nuke debug spew from the ANONYMOUS authentication method
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-14 10:13:43 -04:00
Colin Walters
3ea204ccf7 gdbusconnection: Avoid tripping assertion if we fail to authenticate twice
If g_bus_get_sync() fails in authentication (because e.g. the process
uid, doesn't match the expected in EXTERNAL), a secondary call to
g_bus_get_sync() would notice we aren't initialized, and try
to initialize.

The assertion here is just wrong; we now explicitly and clearly handle
both cases where we already have an error, or we already succeeded.

https://bugzilla.gnome.org/show_bug.cgi?id=635694
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-14 10:13:18 -04:00
Matthias Clasen
43882037fd Fix another faulty GApplicationCommandline example
Several flaws were pointed out by Shaun McCance. We were
leaking handled arguments, and we were mishandling the last
argument, and we were actually skipping arguments too.

https://bugzilla.gnome.org/show_bug.cgi?id=647031
2011-04-08 17:03:20 -04:00
Ryan Lortie
ddfddbcb40 Don't assert on backend == settings->priv->backend
They could be different if a notification is queued for delivery and
someone calls g_settings_delay().

Bug #646843.
2011-04-08 13:16:33 -04:00
Matthias Clasen
2aad89ab9b Avoid an interaction between GApplication and GOption
When using GOption to handle commandlines, we need to disable
the builtin help handling, since it calls exit(). Also mention
this particular pitfall in the docs.
2011-04-08 07:17:55 -04:00
Matthias Clasen
faa896642d Add a warning to the g_dbus_connection_set_exit_on_close docs
Tell people to not leak their apps out of the session.
2011-04-07 17:16:44 -04:00
Murray Cumming
092a3c2419 Docs: Change DBus to D-Bus 2011-04-04 09:23:17 +02:00
Murray Cumming
cdeb2dbd47 GDBusMethodInvocation: Improve get_parameters() documentation.
Note that the returned GVariant is always a tuple.
See bug #646420.
2011-04-03 09:11:59 +02:00
Matthias Clasen
471498c621 Docs: explain what a NULL vtable might be good for
https://bugzilla.gnome.org/show_bug.cgi?id=646419
2011-04-01 13:44:23 -04:00
Matthias Clasen
770442f2de Remove a reference to a nonexisting function from the docs
There is sadly no async g_dbus_server_new() function.
https://bugzilla.gnome.org/show_bug.cgi?id=646422
2011-04-01 11:50:38 -04:00