Commit Graph

10626 Commits

Author SHA1 Message Date
Simon McVittie
c180ea13ae 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:00:22 -04:00
Simon McVittie
8097e2de85 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:00:22 -04:00
Simon McVittie
a8f75f21b4 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:00:22 -04:00
Ryan Lortie
05ef173466 Disable two GDBus tests
These tests try to use GMainContext across fork() which now fails a lot
more violently than it used to.

See https://bugzilla.gnome.org/show_bug.cgi?id=658999 for information.
2011-09-16 11:18:26 -04:00
Murray Cumming
0bb01a150f Revert "Add g_memory_input_stream_new_from_data_full/add_data_full() apis"
I'm not sure that this API is right now that I try to use it.

This reverts commit 42738469d1.
2011-09-16 16:09:56 +02:00
Tristan Van Berkom
42738469d1 Add g_memory_input_stream_new_from_data_full/add_data_full() apis
Add an extra state pointer and an extra GDestroyNotify function
to the 'Chunk' definition... allowing bindings to attach some extra
state to memory chunks (to get memory management correctly from
language bindings).
Bug #589887
2011-09-16 15:37:06 +02:00
Behdad Esfahbod
b7051e8da8 Fix docs 2011-09-15 16:51:51 -04:00
Ryan Lortie
43007aa2d2 GApplication: don't create a mainloop
Just iterate the main context directly.  Also: avoid calling the virtual
functions for mainloops.

https://bugzilla.gnome.org/show_bug.cgi?id=658805
2011-09-14 14:09:12 -04:00
Ryan Lortie
39294664a6 GApplication test: fix testcase to avoid fork()
The GApplication test case tried to fork() while using GMainLoop,
causing problems.  Avoid doing that by splitting the child process into
a separate program and spawning it in the usual way.

https://bugzilla.gnome.org/show_bug.cgi?id=658999
2011-09-14 14:09:12 -04:00
Ryan Lortie
01ed78d525 mainloop: detect fork() and abort
Abort if the child process returns to the mainloop after a fork().

https://bugzilla.gnome.org/show_bug.cgi?id=658999
2011-09-14 14:09:07 -04:00
Ryan Lortie
01f9479438 GApplication: add chain-up checks
Make sure ::startup and ::shutdown are being chained up.
2011-09-14 14:00:08 -04:00
Brian Koning
15b1c1bf4f GApplication: introduce ::shutdown
Introduce ::shutdown as a dual to ::startup.

https://bugzilla.gnome.org/show_bug.cgi?id=643934
2011-09-14 13:45:44 -04:00
Yuri Myasoedov
8d52bdfd97 Updated Russian translation 2011-09-14 21:28:00 +04:00
Tomas Bzatek
659b287a92 gdbus-codegen: Fix segfault when remote property is invalidated
The 'key' variable is no longer valid outside the cycle, owned and
probably already freed by GVariant. This causes apps to segfault
when proxy is constructed and a property on remote d-bus service
changes (actually is invalidated). Looks like a typo anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=659070
2011-09-14 19:02:01 +02:00
Og B. Maciel
53e52d9f72 Updated Brazilian Portuguese translation. 2011-09-14 09:14:02 -04:00
Richard Hughes
8152e3f54e Fix the description for g_app_info_get_icon()
It can return NULL when there is no default icon.
2011-09-13 16:38:40 +01:00
I Felix
2dd32d24f3 Updated Tamil Translations 2011-09-13 15:40:27 +05:30
I Felix
d1bcb0032d Updated Tamil Translations 2011-09-13 15:34:22 +05:30
Ryan Lortie
1b03391984 Merge remote-tracking branch 'gvdb/master' 2011-09-12 08:12:57 -04:00
Ryan Lortie
92652ac791 hashing: always use signed chars
Our hashing of non-ASCII strings was undefined due to the fact that
'char' is signed on some platforms, unsigned on others.  Always use a
signed char.

Discovered by Alexander Larsson.

https://bugzilla.gnome.org/show_bug.cgi?id=658806
2011-09-12 08:12:44 -04:00
Matthias Clasen
2d44a45b6b GDesktopAppInfo: Improve docs 2011-09-12 01:56:45 -04:00
Matthias Clasen
05342d0a93 Fix formatting in a doc comment 2011-09-12 01:49:01 -04:00
Matthias Clasen
73c427fab9 Expand mimeapps test
This adds a test involving both defaults.list and mimeapps.list.
2011-09-12 01:46:48 -04:00
Matthias Clasen
2ba5a79a70 Also check api results
In addition to looking at mimeapps.list, check that the default
and recommended apps returned by g_app_info api are as expected.
2011-09-11 23:39:29 -04:00
Matthias Clasen
75c989b9ab Revert "Fix default setting generation in g_desktop_app_info_set_as_last_used"
This reverts commit a13f5ca4da.
2011-09-11 23:28:45 -04:00
Matthias Clasen
938e57dd4b Adapt tests to string changes 2011-09-11 23:28:44 -04:00
Ryan Lortie
cab5b8abd3 GType tutorial: clarify class struct initialisation
Make the information on how the class structure is initialised less
confusing to first-time readers.
2011-09-11 15:48:47 -04:00
Matthias Clasen
61b51555ec Cosmetics
Make configure --help output a little more regular, by using
AC_HELP_STRING() more consistently.
2011-09-11 13:15:29 -04:00
Jorge González
5b86231251 Updated Spanish translation 2011-09-11 11:05:50 +02:00
Matthias Clasen
0db179e75e GKeyFile: Unify error messsages a bit
This marks a few forgotten error messages for translation, and
makes some other strings more uniform. String change!

https://bugzilla.gnome.org/show_bug.cgi?id=658715
2011-09-10 16:10:49 -04:00
Matthias Clasen
ec3653be00 glib-compile-schemas: Pedantic string fixes
Replace 'can not' by 'cannot' in several places. String change!

https://bugzilla.gnome.org/show_bug.cgi?id=658207
2011-09-10 10:36:56 -04:00
Gabor Kelemen
b1e04b2986 Updated Hungarian translation 2011-09-10 14:39:43 +02:00
Josselin Mouette
a13f5ca4da 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:26:12 +02:00
Matthias Clasen
011c0b488f Add some tests for mimeapps.list handling
These tests directly look at mimeapps.list to verify that
we make the expected changes to the database.
2011-09-09 23:44:41 -04:00
Matthias Clasen
66a1dfc84f Avoid some compiler warnings 2011-09-09 23:44:41 -04:00
Ryan Lortie
644ab6a7d3 Nix inaccurately named g_main_context_init_pipe()
...and fold its contents into g_main_context_new()
2011-09-09 22:33:33 -04:00
Ryan Lortie
1c8c408c51 gmain: get rid of poll_waiting
This variable, which is the cause of much grief, exists for two reasons:

  - ensuring the the wakeup pipe doesn't fill up

  - preventing the first poll() after adding a source from waking up
    immediately

The first point is no longer an issue with GWakeup.

The second point is addressed by using different logic: we only signal a
wakeup in the case that the context is currently acquired by a thread
that is not us.

As an added bonus, we can now implement g_main_context_wakeup() without
taking a lock.

https://bugzilla.gnome.org/show_bug.cgi?id=583511
https://bugzilla.gnome.org/show_bug.cgi?id=320888
2011-09-09 22:32:06 -04:00
Emmanuele Bassi
e15d5313af Add macros for GSourceFunc return values
The boolean values to be returned by a GSourceFunc are always ambiguous,
and even in case of experienced developers then can lead to confusion.

The Perl bindings for GLib have two simple constants, mapping to TRUE
and FALSE, that make the return values less confusing: G_SOURCE_CONTINUE
and G_SOURCE_REMOVE respectively.

https://bugzilla.gnome.org/show_bug.cgi?id=631413
2011-09-09 22:08:58 -04:00
Matthias Clasen
e5653c0050 Keep up with the standards
More choices, always better.
2011-09-09 20:37:09 -04:00
Ryan Lortie
066c7b8121 GRegex: fix thread-unsafe initialiser code 2011-09-09 19:54:06 -04:00
Ryan Lortie
f1494c156d Clean up l10n threading stuff
Remove the explicit thread initialisation functions for g_get_charset(),
g_get_filename_charsets() and g_get_language_names().

Add a lock around one remaining case of access to libcharset (the other
2 cases already have the lock).

Do a proper g_once_init_enter() style initialisation for the GLib
gettext functions.

https://bugzilla.gnome.org/show_bug.cgi?id=658683
2011-09-09 19:50:55 -04:00
Ryan Lortie
bceaf3a719 glib-private: #include <glib.h>
This is really our only choice if we don't want to annoy the
single-include checking when we use this from inside of gio.
2011-09-09 16:05:55 -04:00
Ryan Lortie
e27b5a2ea7 Drop long-removed atomic thread init from header 2011-09-09 15:47:01 -04:00
Ryan Lortie
9e1d4aa257 Remove now-useless glibprivate.h
The only symbol in glibprivate.h was moved to glib-private.h.
2011-09-09 15:21:07 -04:00
Ryan Lortie
d86386159d glib worker: move to glib-private framework
Remove the private glib_get_worker_context() symbol and move it over to
using the glib-private stuff like GWakeup is doing.

https://bugzilla.gnome.org/show_bug.cgi?id=657992
2011-09-09 14:32:00 -04:00
Ryan Lortie
3022ef4731 gwakeup.h: add missing header for GPollFD 2011-09-09 14:30:01 -04:00
Colin Walters
9bf59d4a14 Add glib__private__() API to share between glib,gio; port GWakeup to it
Historically we've added random symbols to the public API with warnings
that they're private; examples are:

glib_gettext(), glib_pgettext()
g_thread_functions_for_glib_use, g_thread_use_default_impl, etc.

And we almost added "GWakeup" to public API just to share between glib and
gio.

This new glib__private__() API exports a hidden vtable, and adds a macro
GLIB_PRIVATE_CALL() that makes it generally convenient to use.

This adds an extremely tiny cost for the double indirection; but it has
the benefit that we don't need to either:

1) compile the code into both glib and gio (like GWakeup), with the
   inefficiency that implies.
2) Export a "do not use this" symbol; the serious problem with this is
   that someone CAN use it pretty easily.  Particularly if we document
   it.  It's far, far harder to peek into a structure without a public
   header file.

https://bugzilla.gnome.org/show_bug.cgi?id=657992
2011-09-09 14:17:08 -04:00
Ryan Lortie
b891b3616f GMainLoop: remove wall clock time cache
Since GMainLoop is now purely monotonic, it really doesn't make sense to
cache the wallclock time just for the sake of making a deprecated call
more efficient.
2011-09-09 13:41:36 -04:00
Ryan Lortie
940a728fda gtester: Remove SIGCHLD race workarounds
With the GMainLoop changes, gtester should now be race-free.
2011-09-09 13:41:27 -04:00
Ryan Lortie
ba7019e19e Modify child and signal sources to use worker 2011-09-09 13:41:27 -04:00