Commit Graph

14199 Commits

Author SHA1 Message Date
Ryan Lortie
5ad7893b51 gmain: Remove dispatching source stack
This stack exists only to answer the question of "what is the currently
dispatching source" and is handled in a way that makes it very clear
that we don't need to be using a linked list at all...

Just store the GSource directly.

Independently discovered (and same solution) by Phillip Susi.

https://bugzilla.gnome.org/show_bug.cgi?id=709113
2013-09-30 12:41:06 -04:00
Mike Ruprecht
4e9e7d0cba GOutputStream: Use async read/write of streams in splice_async()
There are some corner cases where using the sync version of read/write
in a thread could cause thread-safety issues. In these cases it's
possible to override the output stream's splice_async() function,
but for input streams one would need to do some acrobatics to
stay thread-safe. Alternatively, some implementations may not even
override their sync read/write functions.

This patch refactors the default splice_async() implementation to
call the sync read and write functions in a thread only when both
async versions are thread-based. When one or both are non-threaded,
it calls the virtual write_async() and read_async() functions of the
involved streams within the same thread.

https://bugzilla.gnome.org/show_bug.cgi?id=691581
2013-09-29 17:48:41 -04:00
Mike Ruprecht
87e5617a65 GOutputStream: Split _close_async for internal use
Refactor g_output_stream_close_async() into itself and an internal
variant for potential use inside other operations (splice_async).
The internal version must be called between
g_output_stream_set_pending() and g_output_stream_clear_pending().

https://bugzilla.gnome.org/show_bug.cgi?id=691581
2013-09-29 17:48:41 -04:00
Mike Ruprecht
416ca8ad57 GOutputStream: Rename _g_output_stream_close_internal() for consistency
https://bugzilla.gnome.org/show_bug.cgi?id=691581
2013-09-29 17:48:41 -04:00
Mike Ruprecht
e967a76728 tests: Add testcases for g_output_stream_splice_async()
Previously, no testcases tested the close flags of
g_output_stream_splice_async. This patch adds tests for that and
also tests various combinations of threaded and non-threaded
GInputStream async reads and GOutputStream async writes.

https://bugzilla.gnome.org/show_bug.cgi?id=691581
2013-09-29 17:48:40 -04:00
Mike Ruprecht
dec3bfeebc GOutputStream: Add g_output_stream_async_write_is_via_threads()
In implementing a better g_output_stream_splice_async() and possibly
other situtations it's helpful to know whether the output stream's
write function internally uses threads. If it and the input stream's
read async functions use threads, then the splice function could
spawn a single thread for better efficiency.

This patch adds a function to determine whether an output stream's
g_output_stream_write_async() function internally uses threads.

https://bugzilla.gnome.org/show_bug.cgi?id=691581
2013-09-29 17:48:40 -04:00
Mike Ruprecht
94a232a4ed GInputStream: Add g_input_stream_async_read_is_via_threads()
In implementing a better g_output_stream_splice_async() and possibly
other situtations it's helpful to know whether the input stream's
read function internally uses threads. If it and the output stream's
write async functions use threads, then the splice function could
spawn a single thread for better efficiency.

This patch adds a function to determine whether an input stream's
g_input_stream_read_async() function internally uses threads.

https://bugzilla.gnome.org/show_bug.cgi?id=691581
2013-09-29 17:48:40 -04:00
John Ralls
ab5aa2aa3a Fix the -Werror=format-nonliteral fixes for older GCCs
They don't allow that pragma inside functions.
2013-09-29 11:33:30 -07:00
John Ralls
09d83640a8 More -Werror=format-nonliteral fixes
This fixes the build with CLang.

https://bugzilla.gnome.org/show_bug.cgi?id=702516
2013-09-29 11:03:16 -04:00
Colin Walters
38d1658b87 gfileutils: Make -Werror=format-nonliteral happy
I tried to please it by using G_GNUC_FORMAT, but that didn't work, so
let's just fall back to pushing an ignore.

https://bugzilla.gnome.org/show_bug.cgi?id=702516
2013-09-29 11:02:30 -04:00
Dan Winship
b5ce635a42 gmessages: fix clang annotations to work with older versions
https://bugzilla.gnome.org/show_bug.cgi?id=708793
2013-09-28 12:31:52 -04:00
Dan Winship
4a953af8a5 gio: make gnetworking.h nodist
https://bugzilla.gnome.org/show_bug.cgi?id=708972
2013-09-28 12:18:14 -04:00
Dan Winship
c9ac45a023 .gitignore: add "signals" 2013-09-28 10:39:01 -04:00
Patrick Welche
e3fa9c9ab6 Only use SA_RESTART if it exists
Fixes build on QNX (and possibly HPUX given Bug 168352)
Patch essentially from pkgsrc devel/glib2/patches/patch-ai

https://bugzilla.gnome.org/show_bug.cgi?id=583321
2013-09-27 17:14:43 +01:00
Bastien Nocera
2d8e5ef81e gdesktopappinfo: Call g_file_get_path() on demand
Rather than always calling out to g_file_get_path() (which
might block, whatever the documentation might say), postpone
the call until we actually need it.

https://bugzilla.gnome.org/show_bug.cgi?id=708753
2013-09-27 09:52:57 +02:00
Robert Ancell
458c1c0f16 gio: Fix documentation for GSocketControlMessage that refers to a 'file description' instead of a 'file descriptor' 2013-09-27 14:52:51 +12:00
Jan Schmidt
0167c3340d gio: Fix -Werror format string errors from mismatched ints. 2013-09-27 10:52:50 +10:00
William Orr
7eb1e5fc5b glocalfile: Only use O_DIRECTORY if available
Solaris 10 for example doesn't have it.

https://bugzilla.gnome.org/show_bug.cgi?id=708860
2013-09-26 15:22:51 -04:00
Yuri Myasoedov
e631507c50 Updated Russian translation 2013-09-25 23:11:29 +04:00
Krzesimir Nowak
3c5aad358c Fix typo in GLIB_VERSION_2_40 docs.
https://bugzilla.gnome.org/show_bug.cgi?id=708714
2013-09-25 09:39:20 +02:00
Shantha kumar
93101f1b89 Tamil Translations Updated 2013-09-25 12:28:53 +05:30
James Strandboge
74314de4d8 gio: Fix typo in the /org/freedesktop/DBus path
https://bugzilla.gnome.org/show_bug.cgi?id=708677
2013-09-24 09:25:51 -04:00
Svante Signell
1d4bb3f5d0 gio/gsocket.c: Fix error code checks when SOCK_CLOEXEC is defined but
not supported on GNU/Hurd.

https://bugzilla.gnome.org/show_bug.cgi?id=708266
2013-09-24 08:59:38 -04:00
Chao-Hsiung Liao
04e784e0c2 Updated Traditional Chinese translation(Hong Kong and Taiwan) 2013-09-24 19:01:24 +08:00
Ryan Lortie
d974d2ec8f Bump version to 2.39.0 2013-09-23 17:47:49 -04:00
Ryan Lortie
fbe3ce89a8 Introduce version macros for 2.40 2013-09-23 17:46:58 -04:00
Ryan Lortie
c8de2b11bb GLib 2.38.0 2013-09-23 17:07:33 -04:00
Ryan Lortie
9da87f597c fix up refcount/properties test case
Recent changes to the properties testcase made invalid use of the GArray
free function.  This free function takes a pointer to the item to be
freed, not the item itself.  Since that item was a pointer to a GObject,
g_object_unref() was getting a GObject**, rather than a GObject*.

The use of GArray in this testcase is pretty questionable in the first
place, so just use C arrays instead.
2013-09-23 17:07:33 -04:00
Ryan Lortie
748c86e45f gio docs: add some missing functions 2013-09-23 17:07:33 -04:00
Ryan Lortie
abf505fd0e More gio-du win32 fixes
Don't free the utf8 filename before the async function completes.

also, gitignore
2013-09-23 16:31:40 -04:00
Ryan Lortie
6d08d1191b Revert "gcancellable: allow g_cancellable_disconnect from "cancelled" handler on same thread"
This reverts commits 83605e2d0a and
140fa7ee46.
2013-09-23 16:15:52 -04:00
Alexander Larsson
140fa7ee46 cancellable: Minor fix to docs
The code uses "my_data", not "data" everywhere else.
2013-09-23 09:11:04 +02:00
Ray Strode
83605e2d0a gcancellable: allow g_cancellable_disconnect from "cancelled" handler on same thread
g_cancellable_disconnect will wait until any pending "cancelled"
handlers finish.  This is useful because disconnecting a handler can have the
side-effect of freeing data that the cancelled handler may rely on.
Unfortunately, the code used to enforce this synchronization between
"cancelled" handlers and g_cancellable_disconnect will also cause
deadlock if the cancelled handler itself calls g_cancellable_disconect.

Obviously, if g_cancellable_disconnect is explicitly called by a "cancelled"
handler, then the "cancelled" handler is shouldering the responsibility
of not using any data that may be freed by disconnection.

Also, g_cancellable_disconnect can be called in unexpected places by
lower layers in the code (for instance as a result of g_source_destroy).
In practice, this means it's easy for deadlocks to inadvertently crop
up when using "cancelled" handlers.

For these reasons, it would be good to fix the deadlock.

This commit prevents the deadlock by allowing foregoing synchronization,
if a pending "cancelled" handler is in the same thread as the
g_cancellabale_disconnnect call.

https://bugzilla.gnome.org/show_bug.cgi?id=705395
2013-09-23 09:09:48 +02:00
Duarte Loreto
795a36142d Updated Portuguese translation 2013-09-23 00:16:05 +01:00
Claude Paroz
bbd8102ee5 Updated French translation 2013-09-22 20:01:57 +02:00
Ray Strode
29ef821766 tests: add signal disconnection test
This commit adds a test to ensure that during a signal emission, if
a signal handler gets disconnected, it won't be run, even if it would
have run before the disconnection.
2013-09-20 16:06:02 -04:00
Ray Strode
cb7059e17f tests: free properties test object from main thread instead of helper thread
The test objects are used from the main thread after the helper threads
are destroyed, so we need to keep them alive until we're done using them.
2013-09-20 16:06:02 -04:00
Dieter Verfaillie
d5c72b334b docs: fix GSourceFuncs docs
"returns" at the start of a description continuation
line seems to confuse GTK-Doc's parser. Rearrange
the text a bit to work around this...

https://bugzilla.gnome.org/show_bug.cgi?id=708445
2013-09-20 21:08:20 +02:00
Murray Cumming
e31ce1cfe3 gsettings: Correct a GLIB_AVAILABLE_IN_* 2013-09-20 09:27:53 +02:00
Misty De Meo
54e79d7dcb gobject: Fix compilation on OS X/ppc64
Apple's GCC compilers cannot deal well with 64-bit pointers in
transparent unions on ppc64, so compilation of
_G_DEFINE_BOXED_TYPE_BEGIN was failing. Fortunately glib already
provides a fallback for compilers that can't deal with it; this adds
this specific case to the check.

https://bugzilla.gnome.org/show_bug.cgi?id=647145
2013-09-19 08:39:18 -04:00
A S Alam
85be7acb95 Punjabi Translation updated by Aman 2013-09-18 08:54:02 -05:00
Ask H. Larsen
0ff1a89f54 Updated Danish translation 2013-09-17 18:28:19 +02:00
Ryan Lortie
c0ecae37f6 GLib 2.37.93 2013-09-17 11:39:56 -04:00
Ryan Lortie
b72c466653 measure_disk_usage: properly report results
In the async case, make sure we copy all of the out parameters from the
results structure, not just 'disk_usage'.
2013-09-17 09:53:18 -04:00
Ryan Lortie
dbf95a5ae9 measure_disk_usage: skip progress on NULL callback
In the real_..._async wrapper for GFile.measure_disk_usage, skip the
wrapping of the progress callback in the case that the user gave a NULL
callback to the async function.  This is a performance improvement
because the sync version won't have to do continuous sampling of the
clock to issue a call to the wrapper which will then do nothing.

Unfortunately, I made this simplifying assumption when writing the
wrapper, but forgot to actually implement it when making the sync call.
As a result, the wrapper is still called, and invokes the NULL callback,
causing a segfault.

Make sure we pass NULL if the user's callback was NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=707787
2013-09-17 09:44:23 -04:00
Chao-Hsiung Liao
1a9b739c31 Updated Traditional Chinese translation(Hong Kong and Taiwan) 2013-09-17 19:35:13 +08:00
Ryan Lortie
373980f545 bump 2013-09-16 14:14:07 -04:00
Ryan Lortie
f4c3e56f19 GLib 2.37.92 2013-09-16 13:47:04 -04:00
Ryan Lortie
348764269d gio-du: show the correct filename in progress
We were showing argv[1] in the progress output before, which is not
always the filename.
2013-09-16 13:42:02 -04:00
Chun-wei Fan
2684dec447 gio-du: Improve test program on Windows
Make use of __wgetmainargs() on Windows so that we can get wide char
versions of the argv's that are passed in when this test program is being
invoked.  This is necessary as one might enter non-ASCII, such as
CJK characters filenames and/or directories to run the test program
against, so that we can process the name(s) and pass the proper
UTF-8-encoded name(s) of the files/directories that is being tested.

https://bugzilla.gnome.org/show_bug.cgi?id=707787
2013-09-16 13:40:14 -04:00