platform/upstream/glib.git
13 years agoFix 1bit mutex test on platforms with 32 bit aligned pointers
Sjoerd Simons [Sun, 13 Nov 2011 16:49:57 +0000 (17:49 +0100)]
Fix 1bit mutex test on platforms with 32 bit aligned pointers

The 1 bit mutex tests asserts: ((gsize) ptrs) % 8, ==, 0), which fails
when the platform only aligns porters to 32 bits (e.g. S390 and
powerpc).

I'm not sure why this assertion was placed here, but given
that internally g_pointer_bit_trylock uses g_atomic_int_or internally
change the assertion so it only requires the alignment to be a multiple
of sizeof(int)

13 years agoAvoid unused variable warnings in g_ascii_strtod
Matthias Clasen [Tue, 15 Nov 2011 04:30:18 +0000 (23:30 -0500)]
Avoid unused variable warnings in g_ascii_strtod

13 years agoGThread: handle thread names safely
Matthias Clasen [Tue, 15 Nov 2011 03:18:13 +0000 (22:18 -0500)]
GThread: handle thread names safely

Avoid a race condition where the string may be freed before
the new thread got around to using it. Also add a test for
thread names.

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

13 years agoSwitch to using template-free docs build
Matthias Clasen [Tue, 15 Nov 2011 02:18:12 +0000 (21:18 -0500)]
Switch to using template-free docs build

All docs are finally inline, so we can do this switch.

13 years agoMove remaining docs inline
Matthias Clasen [Mon, 14 Nov 2011 12:44:52 +0000 (07:44 -0500)]
Move remaining docs inline

This introduces a fake source file just for holding
docs that have no good place elsewhere. Not great, but
better than templates.

13 years agoMove GModule docs inline
Matthias Clasen [Tue, 15 Nov 2011 02:06:30 +0000 (21:06 -0500)]
Move GModule docs inline

13 years agoMove GDate docs inline
Matthias Clasen [Sun, 13 Nov 2011 20:37:56 +0000 (15:37 -0500)]
Move GDate docs inline

13 years agoMove i18n docs inline
Matthias Clasen [Sun, 13 Nov 2011 05:43:50 +0000 (00:43 -0500)]
Move i18n docs inline

13 years agoMove slice and hook docs inline
Matthias Clasen [Sun, 13 Nov 2011 05:26:57 +0000 (00:26 -0500)]
Move slice and hook docs inline

13 years agoGSocketClient: improve error messages on connection failure
Dan Winship [Tue, 15 Nov 2011 00:46:02 +0000 (19:46 -0500)]
GSocketClient: improve error messages on connection failure

Include the hostname (or proxy hostname if it was the connection to
the proxy server that failed) in the GError message when
g_socket_client_connect* fail.

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

13 years agoGUnixInput/OutputStream: fix blocking methods to always block
Dan Winship [Mon, 14 Nov 2011 23:27:34 +0000 (18:27 -0500)]
GUnixInput/OutputStream: fix blocking methods to always block

Previously, if you created a GUnixInputStream or GUnixOutputStream
from a non-blocking file descriptor, it might sometimes return
G_IO_ERROR_WOULD_BLOCK from g_input_stream_read/g_output_stream_write,
which is wrong. Fix that. (Use the GPollableInput/OutputStream methods
if you want non-blocking I/O.)

Also, add a test for this to gio/tests/unix-streams.

Also, fix the GError messages to say "Error reading from file
descriptor", etc instead of "Error reading from unix" (which was
presumably from a bad search and replace job).

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

13 years agoFix glib/tests/utils for g_parse_debug_string() changes
Dan Winship [Mon, 14 Nov 2011 18:55:14 +0000 (13:55 -0500)]
Fix glib/tests/utils for g_parse_debug_string() changes

13 years agoadd GNetworkMonitor, for... monitoring the network
Dan Winship [Sun, 12 Jun 2011 19:59:36 +0000 (15:59 -0400)]
add GNetworkMonitor, for... monitoring the network

Add GNetworkMonitor and its associated extension point, provide a base
implementation that always claims the network is available, and a
netlink-based implementation built on top of that that actually tracks
the network state.

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

13 years agoGInetAddressMask: new type for internet address range matching
Dan Winship [Sat, 1 Oct 2011 12:31:54 +0000 (08:31 -0400)]
GInetAddressMask: new type for internet address range matching

Eg, for matching a GInetAddress to a range like "10.0.0.0/8" or
"fe80::/10"

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

13 years agogunixinput/outputstream: fix docs
Dan Winship [Sun, 13 Nov 2011 21:39:45 +0000 (16:39 -0500)]
gunixinput/outputstream: fix docs

Don't try to link to the docs of undocumented private classes

13 years agoGUnixInputStream, GUnixOutputStream: support ordinary files better
Dan Winship [Tue, 27 Apr 2010 20:54:18 +0000 (16:54 -0400)]
GUnixInputStream, GUnixOutputStream: support ordinary files better

If the fd is not a pipe or socket, fall back to using threads to do
async I/O rather than poll, since poll doesn't work the way you want
for ordinary files.

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

13 years agoSome more docs reshuffling
Matthias Clasen [Sun, 13 Nov 2011 03:52:24 +0000 (22:52 -0500)]
Some more docs reshuffling

13 years agoMore consistent doc formatting
Matthias Clasen [Sun, 13 Nov 2011 02:54:42 +0000 (21:54 -0500)]
More consistent doc formatting

Move some things around, make capitalization of short descriptions
more consistent.

13 years agoCleanups to debug env var handling
Matthias Clasen [Sun, 13 Nov 2011 00:13:44 +0000 (19:13 -0500)]
Cleanups to debug env var handling

13 years agoParse G_DEBUG only once
Matthias Clasen [Sat, 12 Nov 2011 23:36:52 +0000 (18:36 -0500)]
Parse G_DEBUG only once

13 years agoglib-unix.h: Add G_BEGIN/END_DECLS
Matthias Clasen [Sat, 12 Nov 2011 15:26:31 +0000 (10:26 -0500)]
glib-unix.h: Add G_BEGIN/END_DECLS

The omission was pointed out in bug 663880.

13 years agogstrfuncs.c: Fix variable declaration
Chun-wei Fan [Sat, 12 Nov 2011 02:38:31 +0000 (10:38 +0800)]
gstrfuncs.c: Fix variable declaration

Declare variables at top of block to stop C89 compilers from complaining.

13 years agoGDBusWorker: tolerate read errors while closing
Simon McVittie [Fri, 11 Nov 2011 14:41:50 +0000 (14:41 +0000)]
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>
13 years agoGDBusWorker: debug on read errors if transport debugging is enabled
Simon McVittie [Thu, 10 Nov 2011 19:06:43 +0000 (19:06 +0000)]
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>
13 years agogdbus-exit-on-close test: don't leak a variant
Simon McVittie [Thu, 3 Nov 2011 18:33:08 +0000 (18:33 +0000)]
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>
13 years agogdbus-exit-on-close test: optionally be more verbose for debugging
Simon McVittie [Thu, 3 Nov 2011 18:32:53 +0000 (18:32 +0000)]
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>
13 years agogio: more implementations of GFileDescriptorBased
Dan Winship [Sat, 3 Sep 2011 13:03:17 +0000 (09:03 -0400)]
gio: more implementations of GFileDescriptorBased

Implement GFileDescriptorBased in GSocket{Input,Output}Stream and
GUnix{Input,Output}Stream.

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

13 years agoNeed to include xlocale.h on Darwin for strtod_l
Kristian Rietveld [Wed, 9 Nov 2011 07:32:33 +0000 (08:32 +0100)]
Need to include xlocale.h on Darwin for strtod_l

This fixes the build of gstrfuncs.c on Darwin.

13 years agoAdd G_SIGNAL_DEPRECATED
Marc-André Lureau [Mon, 7 Nov 2011 19:04:15 +0000 (20:04 +0100)]
Add G_SIGNAL_DEPRECATED

Similar to G_PARAM_DEPRECATED. It will warn only for users of the
signals, so a signal can still be emited without warning, for
compatibility reasons.

Apparently, there is no way user flags could have been used before,
so that shouldn't break anyone.

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

13 years agogio/tests/proxy: don't use deprecated functions
Dan Winship [Mon, 7 Nov 2011 18:50:00 +0000 (13:50 -0500)]
gio/tests/proxy: don't use deprecated functions

13 years agoFix g_variant_get_gtype() deprecation message
Dan Winship [Mon, 7 Nov 2011 18:48:30 +0000 (13:48 -0500)]
Fix g_variant_get_gtype() deprecation message

Instead of:

warning: ‘g_variant_get_gtype’ is deprecated (declared at ../../gobject/glib-types.h:242): Use '((GType) ((21) << (2)))' instead [-Wdeprecated-declarations]

show:

warning: ‘g_variant_get_gtype’ is deprecated (declared at ../../gobject/glib-types.h:242): Use ''G_VARIANT_GET_TYPE'' instead [-Wdeprecated-declarations]

Also, document the macro-expansion problem in the
G_GNUC_DEPRECATED_FOR docs

13 years agodocs: Improve g_variant_loop() docs
Benjamin Otte [Sun, 16 Oct 2011 19:58:29 +0000 (12:58 -0700)]
docs: Improve g_variant_loop() docs

Typo fix and changing "is not recommended" to the nice version of "don't
do this", aka "causes undefined behavior".

13 years agodocs: Tell which function to use to avoid errors.
Benjamin Otte [Mon, 25 Jul 2011 11:08:59 +0000 (13:08 +0200)]
docs: Tell which function to use to avoid errors.

13 years agoUpdate VS property sheets
Chun-wei Fan [Mon, 7 Nov 2011 06:14:45 +0000 (14:14 +0800)]
Update VS property sheets

gmain.h was added into the list of deprecated headers, so "install"
that as weel.

13 years agoAdd a test for CDATA in gschema.xml files
Matthias Clasen [Mon, 7 Nov 2011 05:14:28 +0000 (00:14 -0500)]
Add a test for CDATA in gschema.xml files

13 years agoAccept CDATA in gschema.xml files
Matthias Clasen [Mon, 7 Nov 2011 05:13:56 +0000 (00:13 -0500)]
Accept CDATA in gschema.xml files

13 years agowin32: Remove some debug spew on startup
Alexander Larsson [Thu, 3 Nov 2011 16:27:08 +0000 (17:27 +0100)]
win32: Remove some debug spew on startup

This is not needed anymore and was causing problems for pkg-config.

13 years agoMake the default log handler more useful
Matthias Clasen [Thu, 3 Nov 2011 05:48:54 +0000 (01:48 -0400)]
Make the default log handler more useful

We make the default log handler only print default and informational
messages if the log domain is explicitly requested.

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

13 years agoMove old deprecated gmain api into deprecated/
Matthias Clasen [Thu, 3 Nov 2011 04:39:31 +0000 (00:39 -0400)]
Move old deprecated gmain api into deprecated/

13 years agoRemove single-include guards in deprecated/
Matthias Clasen [Thu, 3 Nov 2011 04:30:56 +0000 (00:30 -0400)]
Remove single-include guards in deprecated/

Not allowed to include these headers single anymore, either.

13 years agoGIO: Don't use G_DISABLE_DEPRECATED for functions
Matthias Clasen [Thu, 3 Nov 2011 04:16:41 +0000 (00:16 -0400)]
GIO: Don't use G_DISABLE_DEPRECATED for functions

13 years agoGObject: Don't use G_DISABLE_DEPRECATED for functions
Matthias Clasen [Thu, 3 Nov 2011 04:09:32 +0000 (00:09 -0400)]
GObject: Don't use G_DISABLE_DEPRECATED for functions

13 years agoUpdate deprecation docs
Matthias Clasen [Thu, 3 Nov 2011 04:05:29 +0000 (00:05 -0400)]
Update deprecation docs

13 years agoDon't use G_DISABLE_DEPRECATED guards around deprecated functions
Matthias Clasen [Thu, 3 Nov 2011 04:04:15 +0000 (00:04 -0400)]
Don't use G_DISABLE_DEPRECATED guards around deprecated functions

I'm leaving the old-style deprecation guards in place around
deprecated macros, enumeration values, etc, for now.

13 years agoglib-mkenums: add --identifier-prefix and --symbol-prefix args
Dan Winship [Fri, 28 Oct 2011 19:38:52 +0000 (15:38 -0400)]
glib-mkenums: add --identifier-prefix and --symbol-prefix args

Allow passing --identifier-prefix and --symbol-prefix to glib-mkenums,
with the same meanings as in g-ir-scanner, to allow fixing up the enum
name parsing globally rather than needing to add a /<* *>/ override to
each enum.

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

13 years agodocs: don't refer to a deprecated glib-mkenums flag
Dan Winship [Fri, 28 Oct 2011 19:38:27 +0000 (15:38 -0400)]
docs: don't refer to a deprecated glib-mkenums flag

Refer to the new flag instead

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

13 years agoglib-mkenums.in: fix @ENUMPREFIX@ with /*< underscore_name=... >*/
Dan Winship [Fri, 14 Oct 2011 18:32:11 +0000 (14:32 -0400)]
glib-mkenums.in: fix @ENUMPREFIX@ with /*< underscore_name=... >*/

For enums defined with an underscore_name override, @ENUMPREFIX@
would include a trailing "_". Fix.

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

13 years agogdbus: avoid warning when finalizing a GDBusObjectManagerClient
Aleksander Morgado [Thu, 27 Oct 2011 14:54:02 +0000 (16:54 +0200)]
gdbus: avoid warning when finalizing a GDBusObjectManagerClient

If the GDBusObjectManagerClient doesn't get a name owner during its lifetime,
`on_control_proxy_g_signal' will never be connected to any signal, so we
shouldn't dump any warning in that case.

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

13 years agog_bus_own_name: fix race when unowning a name immediately after owning it
David Zeuthen [Thu, 27 Oct 2011 14:30:58 +0000 (10:30 -0400)]
g_bus_own_name: fix race when unowning a name immediately after owning it

... and also add a test to verify that the fix works.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoRevert "gthread: G_STATIC_MUTEX_INIT: Fix this for the non-win32 case."
Ryan Lortie [Wed, 26 Oct 2011 19:10:33 +0000 (15:10 -0400)]
Revert "gthread: G_STATIC_MUTEX_INIT: Fix this for the non-win32 case."

This reverts commit 52fd106724aa79ad57ecaa7ad9d340f8c89da06d.

13 years agogthread: G_STATIC_MUTEX_INIT: Fix this for the non-win32 case.
Murray Cumming [Wed, 26 Oct 2011 09:38:13 +0000 (11:38 +0200)]
gthread: G_STATIC_MUTEX_INIT: Fix this for the non-win32 case.

Also initialize the unused member. This was correct before but
was broken when the ifndef was moved inside the GStaticMutex
struct:
http://git.gnome.org/browse/glib/commit/glib/gthread.h?id=24652730a9faaedb19b9e90024077eb7f75a6907
This avoids a compiler warning.

13 years agoAdd TAGS files to .gitignore
Damien Lespinau [Tue, 25 Oct 2011 02:25:59 +0000 (22:25 -0400)]
Add TAGS files to .gitignore

"make tags" is the best way to produce tags in an automake project and
yet very few people are using it so the tags files it generates are never
added to the .gitignore files.

Add TAGS files to .gitignore then.

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

13 years agoFix some build issues on OpenBSD
Robert Nagy [Tue, 25 Oct 2011 01:18:48 +0000 (21:18 -0400)]
Fix some build issues on OpenBSD

Adapt to some OpenBSD header quirks.
Patch by Robert Nagy.

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

13 years agoFix document generation in out of tree builds
Sjoerd Simons [Fri, 21 Oct 2011 13:40:56 +0000 (15:40 +0200)]
Fix document generation in out of tree builds

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

13 years agog_parse_debug_string: invert flags given besides "all"
Will Thompson [Thu, 20 Oct 2011 15:07:03 +0000 (16:07 +0100)]
g_parse_debug_string: invert flags given besides "all"

Any flags specified as well as "all" are subtracted from the result,
allowing the user to specify FOO_DEBUG="all,bar,baz" to mean "give me
debugging information for everything except bar and baz".

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

13 years agoTest g_parse_debug_string ("all")
Will Thompson [Wed, 16 Feb 2011 10:48:22 +0000 (10:48 +0000)]
Test g_parse_debug_string ("all")

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

13 years agoFix 'make check' with clang
Matthias Clasen [Mon, 24 Oct 2011 17:43:11 +0000 (13:43 -0400)]
Fix 'make check' with clang

Patch by Elias Pipping

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

13 years agoFix g_hash_table_iter_replace
Matthias Clasen [Mon, 24 Oct 2011 17:25:15 +0000 (13:25 -0400)]
Fix g_hash_table_iter_replace

When reusing an existing key 'internally', we must avoid calling
the key_destroy function on the old key.

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

13 years agoGDBusConnection: document that this object is (meant to be) thread-safe
Simon McVittie [Fri, 21 Oct 2011 10:42:10 +0000 (11:42 +0100)]
GDBusConnection: document that this object is (meant to be) thread-safe

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusConnection: make the closed flag atomic (but still lock to write)
Simon McVittie [Fri, 21 Oct 2011 14:46:00 +0000 (15:46 +0100)]
GDBusConnection: make the closed flag atomic (but still lock to write)

Strictly speaking, neither of the two uses that aren't under the lock
*needs* to be atomic, but it seems better to be obviously correct (and
we save another 4 bytes of struct).

One of these uses is in g_dbus_connection_is_closed(), any use of which
is inherently a race condition anyway.

The other is g_dbus_connection_flush_sync, which as far as I can tell
just needs a best-effort check, to not waste effort on a connection that
has been closed for a while (but I could be wrong).

I removed the check for the closed flag altogether in
g_dbus_connection_send_message_with_reply_unlocked, because it turns out
to be redundant with one in g_dbus_connection_send_message_unlocked,
which is called immediately after.

g_dbus_connection_close_sync held the lock to check the closed flag,
which is no longer needed.

As far as I can tell, the only reason why the lock is still desirable
when setting the closed flag is so that remove_match_rule can't fail
by racing with close notification from the worker thread - but
on_worker_closed needs to hold the lock anyway, to deal with other
data structures, so there's no point in trying to eliminate the
requirement to hold the lock.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusConnection: document which properties are protected by @lock
Simon McVittie [Fri, 21 Oct 2011 15:24:29 +0000 (16:24 +0100)]
GDBusConnection: document which properties are protected by @lock

Also, a few that don't need to be.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusConnection: access the exit-on-close flag atomically
Simon McVittie [Mon, 17 Oct 2011 18:27:23 +0000 (19:27 +0100)]
GDBusConnection: access the exit-on-close flag atomically

This isn't strictly necessary, because in every location where it's
checked, if the reading thread misses an update from another thread,
it's indistinguishable from the reading thread having been scheduled
before the writing thread, which is an unavoidable race condition that
callers need to cope with anyway. On the other hand, merging exit_on_close
into atomic_flags gives the least astonishing semantics to library users
and saves 4 bytes of struct, and if you're accessing exit-on-close often
enough for it to be a performance concern, you're probably doing it wrong.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agoAnnotate GDBusConnection private functions with thread/lock status
Simon McVittie [Mon, 17 Oct 2011 12:27:03 +0000 (13:27 +0100)]
Annotate GDBusConnection private functions with thread/lock status

The thread shared between all GDBusWorker instances was variously called
the "worker thread" or "message handler thread", which I mostly changed to
"the GDBusWorker thread" to avoid ambiguity.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agoUpdated Hebrew translation.
Yaron Shahrabani [Sat, 22 Oct 2011 10:39:15 +0000 (12:39 +0200)]
Updated Hebrew translation.

13 years agoUpdated Slovenian translation
Matej Urbančič [Fri, 21 Oct 2011 19:24:06 +0000 (21:24 +0200)]
Updated Slovenian translation

13 years agoGDBusMessage: fix leak of GError
Ryan Lortie [Fri, 21 Oct 2011 18:05:10 +0000 (14:05 -0400)]
GDBusMessage: fix leak of GError

As part of the deserialisation process of a zero-length array in the
DBus wire format, parse_value_from_blob() recursively calls itself with
the expectation of failing (as can be seen by the assert immediately
following).

It passes &local_error to this always-failing call and then fails to
free it (indeed, to use it at all).  The result is that the GError is
leaked.

Fix it by passing in NULL instead, so that the GError is never created
in the first place.

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

13 years agoGVariant format string docs: fix maybe types
Ryan Lortie [Fri, 21 Oct 2011 19:00:24 +0000 (15:00 -0400)]
GVariant format string docs: fix maybe types

The documentation for maybe types failed to mention 'a' as one of the
types that was handled with a single pointer for which NULL means
"nothing".  Correct that omission.

Problem caught by Shaun McCance.

13 years agoMake g_ascii_strtod behave as documented
Matthias Clasen [Fri, 21 Oct 2011 18:57:47 +0000 (14:57 -0400)]
Make g_ascii_strtod behave as documented

The docs explicitly state that we reset errno, so lets do that,
even if we just wrap strtod_l. Also move the argument check
out of the ifdef.

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

13 years agoGDBusConnection: check for initializedness in most public API
Simon McVittie [Wed, 19 Oct 2011 16:23:30 +0000 (17:23 +0100)]
GDBusConnection: check for initializedness in most public API

The only exceptions are those of the trivial getters/setters that don't
already need the initialization check for its secondary role as a memory
barrier (this is consistent with GSocket, where trivial getters/setters
don't check):

* g_dbus_connection_set_exit_on_close
* g_dbus_connection_get_exit_on_close
* g_dbus_connection_is_closed

g_dbus_connection_set_exit_on_close needs to be safe for
use before initialization anyway, so it can be set at construct-time.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661689
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusConnection: document use while uninitialized as undefined behaviour
Simon McVittie [Thu, 20 Oct 2011 19:02:02 +0000 (20:02 +0100)]
GDBusConnection: document use while uninitialized as undefined behaviour

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661689
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662208
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusConnection: check for initialization where needed for thread-safety
Simon McVittie [Thu, 20 Oct 2011 12:12:26 +0000 (13:12 +0100)]
GDBusConnection: check for initialization where needed for thread-safety

Also document which fields require such a check in order to have correct
threading semantics.

This usage doesn't matches the GInitable documentation, which suggests
use of a GError - but using an uninitialized GDBusConnection is
programming error, and not usefully recoverable. (The GInitable
documentation may have been a mistake - GNOME#662208.) Also, not all of
the places where we need it can raise a GError.

The check serves a dual purpose: it turns a non-deterministic crash into
a deterministic critical warning, and is also a memory barrier for
thread-safety. All of these functions dereference or return fields that
are meant to be protected by FLAG_INITIALIZED, so they could crash or
return an undefined value to their caller without this, if called from a
thread that isn't the one that called initable_init() (although I can't
think of any way to do that without encountering a memory barrier,
undefined behaviour, or a race condition that leads to undefined
behaviour if the non-initializing thread wins the race).

One exception is that initable_init() itself makes a synchronous call.
We deal with that by passing new internal flags up the call stack, to
reassure g_dbus_connection_send_message_unlocked() that it can go ahead.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661689
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusConnection: replace is_initialized with an atomic flag
Simon McVittie [Fri, 21 Oct 2011 15:02:22 +0000 (16:02 +0100)]
GDBusConnection: replace is_initialized with an atomic flag

The comment implied that even failed initialization would set
is_initialized = TRUE, but this wasn't the case - failed initialization
would only set initialization_error, and it was necessary to check both.

It turns out the documented semantics are nicer than the implemented
semantics, since this lets us use atomic operations, which are also
memory barriers, to avoid needing separate memory barriers or locks
for initialization_error (and other members that are read-only after
construction).

I expect to need more than one atomically-accessed flag to fix thread
safety, so instead of a minimal implementation I've turned is_initialized
into a flags word.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661689
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agoFix VS 2008 property sheet
Chun-wei Fan [Thu, 20 Oct 2011 06:42:51 +0000 (14:42 +0800)]
Fix VS 2008 property sheet

Missed a required ';'-sorry about this.  DOH! :|

13 years agoDeprecate g_atexit
Matthias Clasen [Thu, 20 Oct 2011 01:03:43 +0000 (21:03 -0400)]
Deprecate g_atexit

This function was just not a good idea to begin with.
Its documentation gives plenty of reason not to use it.

13 years agodesktop-app-info: annotate g_desktop_app_info_get_keywords()
Cosimo Cecchi [Tue, 18 Oct 2011 14:48:31 +0000 (10:48 -0400)]
desktop-app-info: annotate g_desktop_app_info_get_keywords()

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

13 years agomore NEWS 2.31.0
Ryan Lortie [Wed, 19 Oct 2011 19:26:25 +0000 (15:26 -0400)]
more NEWS

13 years agoThe usual docs unbreaking...
Ryan Lortie [Wed, 19 Oct 2011 19:07:22 +0000 (15:07 -0400)]
The usual docs unbreaking...

13 years agoconfigure.ac: join the cargo-cult of _cv_
Ryan Lortie [Wed, 19 Oct 2011 14:11:54 +0000 (10:11 -0400)]
configure.ac: join the cargo-cult of _cv_

For some reason, the setting of g_atomic_lock_free wasn't making it down
to the lower part of the configure script where glibconfig.h was being
generated when building using mingw32-configure.

If we prefix glib_cv_ to the start of the variable name (like everyone
else is doing) then it magically starts working.

I love you, automake.

13 years agogdbus-non-socket test: avoid use of a GMainContext across a fork
Simon McVittie [Tue, 18 Oct 2011 15:19:43 +0000 (16:19 +0100)]
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.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agogdbus-exit-on-close test: cover more possibilities
Simon McVittie [Tue, 18 Oct 2011 15:18:21 +0000 (16:18 +0100)]
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
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusWorker: if a read was cancelled it means we closed the connection
Simon McVittie [Wed, 19 Oct 2011 09:49:56 +0000 (10:49 +0100)]
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
Bug-NB: NB#287088
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agoRevert "Disable two GDBus tests"
Simon McVittie [Tue, 18 Oct 2011 15:27:21 +0000 (16:27 +0100)]
Revert "Disable two GDBus tests"

This reverts commit 05ef173466e32d8b3d212803e4a72239913a362d.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662100
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: David Zeuthen <davidz@redhat.com>
13 years agoFix bug in g_static_rec_mutex_unlock_full()
Ryan Lortie [Wed, 19 Oct 2011 03:26:00 +0000 (23:26 -0400)]
Fix bug in g_static_rec_mutex_unlock_full()

pthreads doesn't implement the _lock_full() and _unlock_full() calls on
recursive mutexes so we don't have it on GRecMutex either.  Now that
we're using GRecMutex to implement GStaticRecMutex, we have to fake it
by keeping an internal counter of the number of locks and calling
g_rec_mutex_unlock() the appropriate number of times.

The code to do this looked like:

  depth = mutex->depth;
  while (mutex->depth--)
    g_rec_mutex_unlock (rm);
  return depth;

which unfortunately did one last decrement after mutex->depth was
already zero (leaving it equal to -1).

When locked the next time, the count would then increase from -1 to 0
and then the next _unlock_full() call would not do any calls to
g_rec_mutex_unlock(), leading to a deadlock.

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

13 years agogatomic: introduce G_ATOMIC_LOCK_FREE
Ryan Lortie [Tue, 18 Oct 2011 20:21:50 +0000 (16:21 -0400)]
gatomic: introduce G_ATOMIC_LOCK_FREE

We clean up the detection of if we should do 'real' atomic operations or
mutex-emulated ones with the introduction of a new (public) macro:
G_ATOMIC_LOCK_FREE.  If defined, our atomic operations are guaranteed to
be done in hardware.

We need to use __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 to determine if our
compiler supports GCC-style atomic operations from the gatomic.h header
because we might be building a program against GLib using a different
set of compiler options (or a different compiler) than was used to build
GLib itself.

Unfortunately, this macro is not available on clang, so it has currently
regressed to using the mutex emulation.  A bug about that has been
opened here:

  http://llvm.org/bugs/show_bug.cgi?id=11174

13 years agogatomic: cast to the correct pointer sign
Ryan Lortie [Tue, 18 Oct 2011 20:21:17 +0000 (16:21 -0400)]
gatomic: cast to the correct pointer sign

In the fallback case of the g_atomic_int_ macros we had some (gint*)
casts that should have been (guint*) casts.

13 years ago[l10n] Updated German translation
Mario Blättermann [Tue, 18 Oct 2011 20:28:23 +0000 (22:28 +0200)]
[l10n] Updated German translation

13 years agogio: Introduce get_sort_key() methods on GDrive, GVolume and GMount
David Zeuthen [Thu, 13 Oct 2011 20:53:44 +0000 (16:53 -0400)]
gio: Introduce get_sort_key() methods on GDrive, GVolume and GMount

This is needed to implement efficient and predictable proxy volume
monitors, see

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

for details.

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agotests/gobject: Use G_VALUE_INIT
Javier Jardón [Sun, 2 Oct 2011 16:58:16 +0000 (17:58 +0100)]
tests/gobject: Use G_VALUE_INIT

13 years agogobject: Use G_VALUE_INIT
Javier Jardón [Fri, 30 Sep 2011 16:19:50 +0000 (17:19 +0100)]
gobject: Use G_VALUE_INIT

13 years agogio: Use G_VALUE_INIT
Javier Jardón [Fri, 30 Sep 2011 16:08:15 +0000 (17:08 +0100)]
gio: Use G_VALUE_INIT

13 years agoGDBusConnection: Fix race in /gdbus/connection/life-cycle
Sjoerd Simons [Sun, 16 Oct 2011 09:57:29 +0000 (10:57 +0100)]
GDBusConnection: Fix race in /gdbus/connection/life-cycle

GDBusConnection sets the closed flag in the worker thread, then adds an
idle callback (which refs the Connection) to signal this in the main
thread. The tests session_bus_down doesn't spin the mainloop, so the
"closed" signal will always fire if iterating the mainloop later (and
drops the ref when doing so). But _is_closed can return TRUE even before
signalling this, in which case the "closed" signal isn't fired and the
ref isn't dropped, causing the test to fail.

Instead simply always wait for the closed signal, which is a good thing
to check anyway and ensures the ref is closed.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661896
Reviewed-by: Matthias Clasen <mclasen@redhat.com>
13 years agoActually Don't define GLIB_COMPILATION in libgthread
Alexander Larsson [Tue, 18 Oct 2011 12:15:07 +0000 (14:15 +0200)]
Actually Don't define GLIB_COMPILATION in libgthread

Last commit was wrong, fixing it up

13 years agoDon't define GLIB_COMPILATION in libgthread
Alexander Larsson [Tue, 18 Oct 2011 11:34:06 +0000 (13:34 +0200)]
Don't define GLIB_COMPILATION in libgthread

This was turning all the GLIB_VARs in the glib headers into
dllexports on windows, causing all sort of nastiness. libgthread is
mostly empty now anyway, so we don't need any GLIB_COMPILATION like
flag.

13 years agoFix an include guard mismatch
Matthias Clasen [Mon, 17 Oct 2011 21:01:36 +0000 (17:01 -0400)]
Fix an include guard mismatch

Spotted by Colin Walters.

13 years agoFix up testcase broken due to g_thread_new API change
Alexander Larsson [Mon, 17 Oct 2011 21:00:29 +0000 (23:00 +0200)]
Fix up testcase broken due to g_thread_new API change

13 years agoMove _glib_get_locale_dir to ggettext.c
Chun-wei Fan [Mon, 17 Oct 2011 16:15:37 +0000 (00:15 +0800)]
Move _glib_get_locale_dir to ggettext.c

-Move _glib_get_locale_dir to ggettext.c, as Matthias suggested
-Made up for the headers that needed to be included in ggettext.c to avoid
 C4013 (implicit declaration of ...) errors/warnings

13 years agoUpdated POTFILES.in
Piotr Drąg [Mon, 17 Oct 2011 16:31:48 +0000 (18:31 +0200)]
Updated POTFILES.in

13 years agoFix gio.symbols
Chun-wei Fan [Mon, 17 Oct 2011 06:54:50 +0000 (14:54 +0800)]
Fix gio.symbols

g_simple_action_get_parameter_type is now static, so this symbol needs to
be removed from here...

13 years agoGLib: Add forgotten includes and build fixes
Chun-wei Fan [Mon, 17 Oct 2011 06:53:58 +0000 (14:53 +0800)]
GLib: Add forgotten includes and build fixes

-gcharset.c, genviron.c, gunicollate.c: Some headers were missed in those
 files that triggered C4013 warnings/errors (aka. implicit declaration
 of ... in GCC).  Make up for them here.
-gwin32.h: Only define g_win32_get_package_installation_directory/
 g_win32_get_package_installation_subdirectory as macros
 (alias of g_win32_get_package_installation_directory_utf8/
 g_win32_get_package_installation_subdirectory_utf8) on Win64 (x64) as
 g_win32_get_package_installation_directory/
 g_win32_get_package_installation_subdirectory have seperate existing
 implmentations for Win32-this is a long-standing problem but was covered-
 up by G_DISABLE_DEPRECATED, which we are stopping to use as of 2.31.0.

13 years agoRevert "Bug 652827 - glib-2.29.8 no longer builds with mingw.org's toolchain"
Ryan Lortie [Mon, 17 Oct 2011 14:54:50 +0000 (10:54 -0400)]
Revert "Bug 652827 - glib-2.29.8 no longer builds with mingw.org's toolchain"

This reverts commit 349212211247781e7bec43b95cb57dddc1d0e5b1.