Commit Graph

11330 Commits

Author SHA1 Message Date
Simon McVittie
fc21c6ced0 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:05:16 +00:00
Simon McVittie
f0c383917b 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:05:04 +00:00
Dan Winship
759c0e935d 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
2011-11-09 08:27:53 -05:00
Kristian Rietveld
f218353e04 Need to include xlocale.h on Darwin for strtod_l
This fixes the build of gstrfuncs.c on Darwin.
2011-11-09 08:32:33 +01:00
Marc-André Lureau
fb95c20c96 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
2011-11-07 23:12:45 +01:00
Dan Winship
f09e71aff0 gio/tests/proxy: don't use deprecated functions 2011-11-07 13:50:00 -05:00
Dan Winship
a5bf1c117b 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
2011-11-07 13:48:30 -05:00
Benjamin Otte
7d1c7af1a6 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".
2011-11-07 15:29:51 +01:00
Benjamin Otte
14677e16d8 docs: Tell which function to use to avoid errors. 2011-11-07 15:29:51 +01:00
Chun-wei Fan
0e283dcb94 Update VS property sheets
gmain.h was added into the list of deprecated headers, so "install"
that as weel.
2011-11-07 14:14:45 +08:00
Matthias Clasen
fc0b8d4f28 Add a test for CDATA in gschema.xml files 2011-11-07 00:14:28 -05:00
Matthias Clasen
7ec69ecd32 Accept CDATA in gschema.xml files 2011-11-07 00:13:56 -05:00
Alexander Larsson
41b8ce7100 win32: Remove some debug spew on startup
This is not needed anymore and was causing problems for pkg-config.
2011-11-03 17:27:08 +01:00
Matthias Clasen
d2d62ecfcd 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
2011-11-03 01:50:29 -04:00
Matthias Clasen
7456b43c3e Move old deprecated gmain api into deprecated/ 2011-11-03 00:39:31 -04:00
Matthias Clasen
a3c8712c4b Remove single-include guards in deprecated/
Not allowed to include these headers single anymore, either.
2011-11-03 00:31:14 -04:00
Matthias Clasen
5896808e8c GIO: Don't use G_DISABLE_DEPRECATED for functions 2011-11-03 00:16:41 -04:00
Matthias Clasen
328be3938e GObject: Don't use G_DISABLE_DEPRECATED for functions 2011-11-03 00:09:32 -04:00
Matthias Clasen
07bcb3f8d6 Update deprecation docs 2011-11-03 00:05:29 -04:00
Matthias Clasen
03766a1a38 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.
2011-11-03 00:04:15 -04:00
Dan Winship
f9c2362e43 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
2011-10-28 18:04:28 -04:00
Dan Winship
78a0dbd853 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
2011-10-28 18:04:28 -04:00
Dan Winship
dd4a8d333d 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
2011-10-28 15:44:13 -04:00
Aleksander Morgado
9782598b81 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
2011-10-27 18:34:27 +02:00
David Zeuthen
1fc897352e 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>
2011-10-27 10:35:18 -04:00
Ryan Lortie
4c038429b1 Revert "gthread: G_STATIC_MUTEX_INIT: Fix this for the non-win32 case."
This reverts commit 52fd106724.
2011-10-26 15:10:33 -04:00
Murray Cumming
52fd106724 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.
2011-10-26 12:11:58 +02:00
Damien Lespinau
73d22207d1 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
2011-10-24 22:26:49 -04:00
Robert Nagy
ba7bf09285 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
2011-10-24 21:20:14 -04:00
Sjoerd Simons
6a81ced72d Fix document generation in out of tree builds
https://bugzilla.gnome.org/show_bug.cgi?id=662390
2011-10-24 20:40:35 -04:00
Will Thompson
5e2a2ef288 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
2011-10-24 20:35:30 -04:00
Will Thompson
73ffa9034f Test g_parse_debug_string ("all")
https://bugzilla.gnome.org/show_bug.cgi?id=642452
2011-10-24 20:26:22 -04:00
Matthias Clasen
94a46ea410 Fix 'make check' with clang
Patch by Elias Pipping

https://bugzilla.gnome.org/show_bug.cgi?id=662491
2011-10-24 13:43:11 -04:00
Matthias Clasen
73e3c98df0 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
2011-10-24 13:29:17 -04:00
Simon McVittie
a124562d1b 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>
2011-10-24 10:40:29 +01:00
Simon McVittie
a031bacaac 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>
2011-10-24 10:40:26 +01:00
Simon McVittie
9857cf8c46 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>
2011-10-24 10:40:23 +01:00
Simon McVittie
8df114f597 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>
2011-10-24 10:40:20 +01:00
Simon McVittie
3a0b60647d 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>
2011-10-24 10:40:06 +01:00
Yaron Shahrabani
a886c2b3b8 Updated Hebrew translation. 2011-10-22 12:39:15 +02:00
Matej Urbančič
c75ee5ed17 Updated Slovenian translation 2011-10-21 21:24:06 +02:00
Ryan Lortie
9c07e7dc90 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
2011-10-21 15:18:20 -04:00
Ryan Lortie
3d13ee1b5f 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.
2011-10-21 15:04:37 -04:00
Matthias Clasen
e52437982c 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
2011-10-21 15:00:14 -04:00
Simon McVittie
848df03e16 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>
2011-10-21 16:02:33 +01:00
Simon McVittie
3958a9fc1e 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>
2011-10-21 16:02:31 +01:00
Simon McVittie
a7ea949294 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>
2011-10-21 16:02:27 +01:00
Simon McVittie
245d68be6f 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>
2011-10-21 16:02:22 +01:00
Chun-wei Fan
e1a481ec0a Fix VS 2008 property sheet
Missed a required ';'-sorry about this.  DOH! :|
2011-10-20 14:42:51 +08:00
Matthias Clasen
269acbe703 Deprecate g_atexit
This function was just not a good idea to begin with.
Its documentation gives plenty of reason not to use it.
2011-10-19 21:03:43 -04:00