Commit Graph

1738 Commits

Author SHA1 Message Date
Christian Persch
6320b04fe9 Plug a mem leak in gsettings test
==2530== 13 bytes in 1 blocks are definitely lost in loss record 373 of 681
==2530==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==2530==    by 0x4057094: g_malloc (gmem.c:134)
==2530==    by 0x40573DB: g_malloc_n (gmem.c:281)
==2530==    by 0x40717FC: g_strdup (gstrfuncs.c:101)
==2530==    by 0x4147F56: value_lcopy_string (gvaluetypes.c:313)
==2530==    by 0x4123F0B: g_object_get_valist (gobject.c:1643)
==2530==    by 0x41240FF: g_object_get (gobject.c:1731)
==2530==    by 0x804A4BA: test_basic (gsettings.c:28)

Bug #628331.
2010-09-03 15:29:51 -04:00
Christian Persch
e8fc3ba3d0 Plug a mem leak
Don't leak the ptr arrays in the map_sender_unique_name_to_signal_data_array
hash table.

==23440== 84 (20 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 920 of 993
==23440==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==23440==    by 0x4057094: g_malloc (gmem.c:134)
==23440==    by 0x406F2D6: g_slice_alloc (gslice.c:836)
==23440==    by 0x401D2D0: g_ptr_array_sized_new (garray.c:799)
==23440==    by 0x401D2AC: g_ptr_array_new (garray.c:783)
==23440==    by 0x420834A: g_dbus_connection_signal_subscribe (gdbusconnection.c:3084)

Bug #628436.
2010-09-03 15:19:22 -04:00
Christian Persch
8795f52aae Plug a mem leak
==31063== 98 (24 direct, 74 indirect) bytes in 1 blocks are definitely lost in loss record 946 of 1,136
==31063==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==31063==    by 0x4057094: g_malloc (gmem.c:134)
==31063==    by 0x406F2D6: g_slice_alloc (gslice.c:836)
==31063==    by 0x4092383: g_variant_get_child_value (gvariant-core.c:847)
==31063==    by 0x408BE9E: g_variant_get_variant (gvariant.c:709)
==31063==    by 0x40903F5: g_variant_valist_get_nnp (gvariant.c:3767)
==31063==    by 0x40907A9: g_variant_valist_get_leaf (gvariant.c:3884)
==31063==    by 0x4090D10: g_variant_valist_get (gvariant.c:4065)
==31063==    by 0x4090E59: g_variant_valist_get (gvariant.c:4100)
==31063==    by 0x40911B6: g_variant_get_va (gvariant.c:4296)
==31063==    by 0x40910BC: g_variant_get (gvariant.c:4248)
==31063==    by 0x4208DAF: invoke_set_property_in_idle_cb (gdbusconnection.c:3676)

Bug #628346.
2010-09-03 15:16:47 -04:00
Christian Persch
1f49f3fa34 Plug a mem leak
... and use g_error_matches().

==29535== 1,360 (408 direct, 952 indirect) bytes in 17 blocks are definitely lost in loss record 1,252 of 1,264
==29535==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==29535==    by 0x4057094: g_malloc (gmem.c:134)
==29535==    by 0x406F2D6: g_slice_alloc (gslice.c:836)
==29535==    by 0x406F31B: g_slice_alloc0 (gslice.c:848)
==29535==    by 0x403A751: g_error_new_valist (gerror.c:54)
==29535==    by 0x403AAD4: g_set_error (gerror.c:240)
==29535==    by 0x41C06C8: g_socket_send_message (gsocket.c:2967)
==29535==    by 0x421CB64: write_message_continue_writing (gdbusprivate.c:958)
==29535==    by 0x421CE2A: write_message_async (gdbusprivate.c:1049)
==29535==    by 0x421D4DD: maybe_write_next_message (gdbusprivate.c:1291)
==29535==    by 0x421D26B: message_written (gdbusprivate.c:1187)
==29535==    by 0x421D322: write_message_cb (gdbusprivate.c:1216)

Bug #628345.
2010-09-03 15:03:24 -04:00
Tor Lillqvist
6ddef375c8 Recuce DLL hijack risk on Windows
Don't call LoadLibrary() on shell32.dll or kernel32.dll. kernel32.dll
is always loaded. Shell32.dll is also already loaded as glib links to
functions in it. So just call GetModuleHandle() on them.

For mlang.dll in win_iconv.c and winhttp.dll in gwinhttpvfs.c, always
try loading them from a complete path, from the Windows system
directory.

Use the "tool help" API to enumerate modules in gmodule-win32.c. It is
present in all Windows versions since Windows 2000, which is all we
support anyway. Thus no need to look that API up dynamically. Just
link to it normally. We can bin the fallback code that attempts to use
the psapi API.
2010-09-02 22:36:47 +03:00
Christian Persch
db0eaa299c Fix building with zlib < 1.2.4 on win32
The gzip header processing functions were only exported
since 1.2.4 on win32, so #ifdef this code accordingly.

Bug #628505.
2010-09-01 15:09:51 +02:00
Ryan Lortie
ed72dcdd45 Fix small bug in registry backend
'n' and 'q' types had their signed/unsigned meaning inverted.
2010-09-01 15:05:42 +02:00
Sam Thursfield
3209024c3b Add GSettings Windows Registry backend 2010-09-01 15:05:42 +02:00
Matthias Clasen
31a72dd719 Update symbol list 2010-08-30 19:31:45 -04:00
David Zeuthen
f4f45e980b GDBusProxy: remove superfluous -gdbus-proxy-method-name qdata
Looks like we're not using this anymore.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-30 13:58:41 -04:00
David Zeuthen
52348e1587 Bug 628324 – Invalid reads in gdbus-export test
Looks like we forgot to ref the returned GVariant in
g_dbus_proxy_call_finish().

It's a good question why code using g_dbus_proxy_call() and
g_dbus_proxy_call_finish() worked in the first place - probably the
answer is that no-one really used these APIs.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-30 13:51:43 -04:00
Ryan Lortie
846b0b3466 GAction is now an interface
the new class GSimpleAction is the implementation half
2010-08-30 19:26:37 +02:00
Ryan Lortie
6cd62920bb GActionGroup is now an interface
- make GAction.get_state() return a reference
 - fix some leaks/warnings in the tests
 - fix signal propagation in GSimpleActionGroup
2010-08-30 19:26:37 +02:00
Christian Persch
9493925854 Make g_emblemed_icon_add_emblem() keep the list sorted
Fixes bug #628317.
2010-08-30 18:34:14 +02:00
Christian Persch
7a6f8bd3c3 Don't leak the FD list
==6793== 32 (24 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record 780 of 1,423
==6793==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==6793==    by 0x4057094: g_malloc (gmem.c:134)
==6793==    by 0x406F2D6: g_slice_alloc (gslice.c:836)
==6793==    by 0x406F31B: g_slice_alloc0 (gslice.c:848)
==6793==    by 0x413D5BB: g_type_create_instance (gtype.c:1867)
==6793==    by 0x412372A: g_object_constructor (gobject.c:1482)
==6793==    by 0x4122E1D: g_object_newv (gobject.c:1266)
==6793==    by 0x4122B93: g_object_new (gobject.c:1178)
==6793==    by 0x41DB582: g_unix_fd_list_new_from_array (gunixfdlist.c:191)
==6793==    by 0x421BFD6: _g_dbus_worker_do_read_cb (gdbusprivate.c:590)

Bug #628329.
2010-08-30 18:33:47 +02:00
Christian Persch
fa671dc5e2 Fix invalid reads
Don't use a guint16* when getting a guint property via g_object_get()!

Bug #628323.
2010-08-30 10:21:43 -04:00
Christian Persch
08924ad147 Plug a mem leak in GConverterOutputStream
==8221== 1,047 (672 direct, 375 indirect) bytes in 28 blocks are definitely lost in loss record 589 of 603
==8221==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==8221==    by 0x4057094: g_malloc (gmem.c:134)
==8221==    by 0x406F2D6: g_slice_alloc (gslice.c:836)
==8221==    by 0x406F31B: g_slice_alloc0 (gslice.c:848)
==8221==    by 0x403A8A6: g_error_new_literal (gerror.c:117)
==8221==    by 0x403AC31: g_set_error_literal (gerror.c:314)
==8221==    by 0x80499DC: g_compressor_converter_convert (converter-stream.c:267)
==8221==    by 0x417BF67: g_converter_convert (gconverter.c:174)
==8221==    by 0x417D7F0: g_converter_output_stream_write (gconverteroutputstream.c:428)
==8221==    by 0x41B57DF: g_output_stream_write (goutputstream.c:216)
==8221==    by 0x804A367: test_compressor (converter-stream.c:456)

Bug #628309.
2010-08-30 10:18:30 -04:00
Christian Persch
802c25832c Plug a mem leak
==6793== 19 (8 direct, 11 indirect) bytes in 1 blocks are definitely lost in loss record 640 of 1,423
==6793==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==6793==    by 0x4057094: g_malloc (gmem.c:134)
==6793==    by 0x40573DB: g_malloc_n (gmem.c:281)
==6793==    by 0x4073D1B: g_strsplit (gstrfuncs.c:2436)
==6793==    by 0x4224A89: initable_init (gdbusserver.c:1040)
==6793==    by 0x41A73F9: g_initable_init (ginitable.c:105)
==6793==    by 0x41A759B: g_initable_new_valist (ginitable.c:218)
==6793==    by 0x41A743E: g_initable_new (ginitable.c:138)
==6793==    by 0x42238F5: g_dbus_server_new_sync (gdbusserver.c:484)

Bug #628328.
2010-08-30 10:16:31 -04:00
Christian Persch
6879256f36 Plug a mem leak
==6793== 16 bytes in 1 blocks are definitely lost in loss record 632 of 1,423
==6793==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==6793==    by 0x4057094: g_malloc (gmem.c:134)
==6793==    by 0x417FC29: g_data_input_stream_read_line (gdatainputstream.c:797)
==6793==    by 0x41F99C1: _my_g_data_input_stream_read_line (gdbusauth.c:279)
==6793==    by 0x41FA728: _g_dbus_auth_run_client (gdbusauth.c:759)

Bug #628327.
2010-08-30 10:14:39 -04:00
Matthias Clasen
bb221b68df Add an annotation 2010-08-30 10:02:32 -04:00
Dan Winship
a3cc274fc6 GSocketClient: fix a crash on cancellation
some code rearrangement when adding proxy support resulted in trying to
use a GSocket that wasn't there.

https://bugzilla.gnome.org/show_bug.cgi?id=628296
2010-08-30 09:31:47 -04:00
Matthias Clasen
b8ff287167 Disable the 'extra data' test for now 2010-08-30 08:58:31 -04:00
Matthias Clasen
b4a61235da Introspection: make 'direction' default to 'in' for methods 2010-08-30 08:50:09 -04:00
Matthias Clasen
c3135d1d39 Add some more gdbus introspection tests (currently failing) 2010-08-30 08:49:41 -04:00
Philip Withnall
1399913f31 Change "type-string" to "type string" in translatable strings
Helps: bgo#628193
2010-08-29 00:38:18 +01:00
Philip Withnall
ea9f5f0251 Change "lock-file" to "lock file" in translatable strings
Helps: bgo#628193
2010-08-29 00:38:06 +01:00
David Zeuthen
1e7243ad7b Bug 628084 – gdbus-peer fails with assertion
Make it work on systems where /etc/hosts is bigger than 1024 bytes.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-27 10:50:03 -04:00
David Zeuthen
0d0a9bb448 GDBusConnection: Document memory management semantics for get_property()
Turns out we are leaking non-floating GVariant instances returned by
get_property() functions.

Also avoid imprecise language such as "newly-allocated GVariant" as
this doesn't specify whether the variant can be floating or not.

Also see https://bugzilla.gnome.org/show_bug.cgi?id=627974 as it is
very related to this change.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-25 14:49:05 -04:00
Tor Lillqvist
6c24062880 Include gproxyaddress.h explicitly 2010-08-23 14:31:20 +03:00
Matthias Clasen
8f40c0e45a Improve GDBus introspection test coverage 2010-08-23 00:38:19 -04:00
David Zeuthen
847e4dfe7d GDBusMethodInvocation: nuke constructor
... that is, make it private. This makes sense because users are never
expected to create such objects themselves - only the GDBus core will
need this.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-22 22:58:29 -04:00
David Zeuthen
3ff9894826 Bug 624546 – Modification of GDBusMessage in filter function
Allow modifying a GDBusMessage in a filter function and also add tests
for this. This breaks API but leaves ABI (almost) intact - at least
dconf's GSettings backend (the only big user I know of) will keep
working.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-05 20:37:27 -04:00
Matthias Clasen
040bffed38 Fix build on !unix
There was one code block still referring to fd_list outside of
the ifdef G_OS_UNIX. Pointed out by Sam Thursfield in bug 627392.
2010-08-21 22:14:28 -04:00
Matthias Clasen
41ce91d057 Better fix for the build problem
Use gnetworkingprivate.h instead, patch by Emilio Pozuelo Monfort,
bug 627407.
2010-08-21 22:09:32 -04:00
Matthias Clasen
3d01283f69 Make gdbus-peer build on !linux
Based on a patch by Koop Mast, bug 627088.
2010-08-21 22:06:56 -04:00
Matthias Clasen
61de05e774 Fix a duplicate word
Pointed out in bug 627604.
2010-08-21 21:58:51 -04:00
Matthias Clasen
a54e2c4fb3 Add some more annotations 2010-08-21 19:27:11 -04:00
Matthias Clasen
892f9b6458 Improve test coverage for actions and action groups 2010-08-21 19:18:40 -04:00
Matthias Clasen
33b775308b Document behaviour wrt. to floating variants 2010-08-21 19:18:17 -04:00
Matthias Clasen
9581b33ca5 Document behaviour wrt to floating variants 2010-08-21 19:11:03 -04:00
Matthias Clasen
e8ffb1ae83 Add some annotations 2010-08-21 18:12:18 -04:00
Ryan Lortie
5b38bc5ad5 Simplify/fix state logic in GAction, test it. 2010-08-21 17:35:32 -04:00
Matthias Clasen
b876e47e3b Fix documentation issues
Gtk-doc is unhappy if the parameter names don't match between header
and source.
2010-08-21 15:34:40 -04:00
Matthias Clasen
4831a102e5 Fix GActionGroup docs 2010-08-21 15:34:18 -04:00
Dan Winship
8f5ec0dad3 Fix misc compiler warnings in (mostly) test programs 2010-08-19 18:24:53 -04:00
Dan Winship
22b3f0d4b2 gio.symbols: add missing g_simple_action_group stuff 2010-08-19 17:51:24 -04:00
Dan Winship
ab778737aa gproxyaddressenumerator.h: add missing G_END_DECLS 2010-08-19 17:51:01 -04:00
Nicolas Dufresne
de1598a34d gio/proxy: Fixed compilation warnings
* Wrong return type (NULL instead of FALSE)
* Unused static function declaration
2010-08-19 17:31:42 -04:00
Nicolas Dufresne
0958e66317 Add support for g_socket_client_add_application_proxy()
This allow application to take control over certain proxy protocol
handling. When a proxy protocol must be used and is found in the
application proxies, GSocketClient will simply TCP connect to the proxy
server and return the connection.

Reviewed-by: Dan Winship <danw@gnome.org>
2010-08-19 16:32:38 -04:00
Nicolas Dufresne
ced1d0e2e7 Implemented SOCKSv4 and SOCKSv4a 2010-08-19 16:32:38 -04:00
Nicolas Dufresne
e2a90bcb5f Implemented proxy sample code that connect to proxy 2010-08-19 16:32:38 -04:00
Nicolas Dufresne
0ebb79a748 Implemented g_socket_client_connect_to_uri() method
Using this rather than g_socket_client_connect() or
g_socket_client_connect_to_host() allows #GSocketClient to
determine when to use application-specific proxy protocols.

Reviewed-by: Dan Winship <danw@gnome.org>
2010-08-19 16:32:37 -04:00
Nicolas Dufresne
a6c3820f46 Hooked proxy enumeration into GSocketClient
This functionnallity can be disabled using property enable-proxy. It
enumerates addresses using GSocketConnectable::proxy_enumerate() instead of
enumerate(). When the returned address is of type GProxyAddress (a type
based on GInetSocketAddress), it gets the proxy protocol handler using
g_proxy_get_default_for_protocol() and call connect() on it.

Reviewed-by: Dan Winship <danw@gnome.org>
2010-08-19 16:32:37 -04:00
Nicolas Dufresne
ee3dbf747e Implement GProxyConnection a GIOStream+GTcpConn wrapper
This class inherit from GTcpConnection by refing the socket of
an existing GTcpConnection and wraps a custom GIOStream into itself. This
is to allow implementing proxies that alters data stream, like when using
GSSAPI privacy inside SOCKS5.
2010-08-19 16:32:37 -04:00
Nicolas Dufresne
6fa1136600 Implemented SOCKSv5 proxy support 2010-08-19 16:32:37 -04:00
Dan Winship
c32ef1d85e GSocket: store the remote_address when connecting
This way, if g_socket_connect() is called with a GProxyAddress,
g_socket_get_remote_address() will later return that same address.

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
2010-08-19 16:32:37 -04:00
Nicolas Dufresne
b304a23af7 Extend IO_ERROR enum for Proxy support 2010-08-19 16:32:37 -04:00
Nicolas Dufresne
1094c84238 Implemented proxy sample for all Connectables 2010-08-19 16:32:37 -04:00
Nicolas Dufresne
fc03ecce83 Implemented proxy_enumerate() for all Connectables
This patch implements method proxy_enumerate from GSocketConnectable for
all connectables (GNetworkAddress, GNetworkService, GInetSocketAddress
and GUnixSocketAddress).

Reviewed-by: Dan Winship <danw@gnome.org>
2010-08-19 16:32:37 -04:00
Nicolas Dufresne
f82f484b8f Added proxy_enumerate method to GSocketConnectable
Reviewed-by: Dan Winship <danw@gnome.org>
2010-08-19 16:32:37 -04:00
Nicolas Dufresne
6749ffce59 Added GProxyAddressEnumerator to proxy sample code 2010-08-19 16:32:37 -04:00
Nicolas Dufresne
a7e0e8fc08 Adding GProxyAddressEnumerator class
An implementation of GSocketAddressEnumerator that handles proxy
enumeration. This class is mainly usefull for Connectables implementation
such as NetworkService, NetworkAddress and SocketAddress to handle proxies.

Reviewed-by: Dan Winship <danw@gnome.org>
2010-08-19 16:32:37 -04:00
Nicolas Dufresne
d76de5e359 Added GProxy interface for proxy extension point
Implement an extension point for proxy protocol implementation. This
is mainly useful for socket-based proxy where it is possible to use the
proxied socket the same way it would for other stream based socket.

Reviewed-by: Dan Winship <danw@gnome.org>
2010-08-19 16:32:37 -04:00
Nicolas Dufresne
63105d1074 Added method g_network_address_parse_uri()
This method allow creating a network address from a URI. If no port is
found in the URI, the default_port parameter will be used. Note that new
property scheme is there for future TLS implementation.

Reviewed-by: Dan Winship <danw@gnome.org>
2010-08-19 16:32:37 -04:00
Nicolas Dufresne
466111c960 Implement GProxyAddress
A GSocketInetAddress representing the proxy server address with additional
properties proxy type, destination address and port, username and password.

Reviewed-by: Dan Winship <danw@gnome.org>
2010-08-19 16:32:37 -04:00
Nicolas Dufresne
6b1d851cc5 Implemented proxy sample code
Reviewed-by: Dan Winship <danw@gnome.org>
2010-08-19 16:32:36 -04:00
Nicolas Dufresne
f3debedfd2 Implemented proxy-resolver extension point
This extension point allow extending GLib with library like LibProxy that
interprets system proxy settings and finds the appropriate configuration
based on the type of connection being made.

Reviewed-by: Dan Winship <danw@gnome.org>
2010-08-19 16:32:36 -04:00
David Zeuthen
7d6a6ca57b Bug 627188 – gdbus-non-socket test occasionally fails
Fix logical bug in test case to avoid race condition between the
client and the server.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-18 13:09:04 -04:00
Matthias Clasen
6c340c0b03 Make gunixcredentialsmessage.h standalone includable 2010-08-18 12:07:38 -04:00
Emmanuele Bassi
81b91a8852 action: Minor fixes
• Argument validation.

• Since: annotations.

• Remove (allow-none) annotations from return values.

• Coding style fixes.
2010-08-18 16:55:40 +01:00
Emmanuele Bassi
504117e284 action-group: Check aginst the correct GType macro
G_TYPE_ACTION_GROUP is not a G_TYPE_ACTION.
2010-08-18 16:55:40 +01:00
David Zeuthen
5bb94348f4 GDBusProxy: Call into well-known name if no name owner currently exists
This is really what (API) users expect from GDBusProxy - in
particular, mclasen and I ran into this problem while debugging a
upower issue, see

 https://bugzilla.redhat.com/show_bug.cgi?id=624125

In a nutshell, the problem is that polkitd crashes while upower holds
a PolkitAuthority object (which in turns contains a GDBusProxy for the
well-known name org.freedesktop.PolicyKit1). This means that
subsequent calls on the PolkitAuthority (which is translated into
calls into the GDBusProxy) fails since :g-name-owner is NULL.

With this fix, we'll be requesting the bus daemon to launch polkitd
since we will start calling into org.freedesktop.PolicyKit1 as soon as
we notice that there is no owner for this name.

Unfortunately our test suite doesn't cover service activation so there
is no way to reliably test this. I will file a bug about this.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-18 11:35:25 -04:00
David Zeuthen
c2945808ac GDBusProxy: Use %, not #, for referencing enum constants in gtk-doc comments
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-18 10:52:28 -04:00
Ryan Lortie
5db9e5ad58 add GSimpleActionGroup
and a simple test
2010-08-18 02:18:54 -04:00
Ryan Lortie
e1ded9f900 add gaction.h to gio.h 2010-08-18 01:56:34 -04:00
Ryan Lortie
8014e9c6e6 add testcase for GAction
fix some small bugs it found
2010-08-18 01:55:48 -04:00
Ryan Lortie
8475d6d7d0 add GAction base class 2010-08-18 01:45:15 -04:00
Ryan Lortie
a3f4ff52ca gio.symbols: Fix missed symbol name tweak 2010-08-18 01:07:07 -04:00
Ryan Lortie
6e04125e35 pad the GActionGroup vtable 2010-08-18 00:37:50 -04:00
Ryan Lortie
6fe74a4c6a Add gactiongroup.h to gio.h 2010-08-18 00:33:17 -04:00
Ryan Lortie
e71dbb9732 add GActionGroup base class 2010-08-18 00:31:33 -04:00
Dan Winship
ddad707b85 update gio/tests/.gitignore 2010-08-17 18:38:34 -04:00
Christian Persch
c56379264d Plug a mem leak in GDBusWorker
Free the read buffer.

==26538== 4,096 bytes in 1 blocks are definitely lost in loss record 781 of 781
==26538==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==26538==    by 0x4005C66: realloc (vg_replace_malloc.c:476)
==26538==    by 0x405244D: g_realloc (gmem.c:181)
==26538==    by 0x420E066: _g_dbus_worker_do_read_unlocked (gdbusprivate.c:780)
==26538==    by 0x420E1D1: _g_dbus_worker_do_read (gdbusprivate.c:812)
==26538==    by 0x420F14A: _g_dbus_worker_thread_begin_func (gdbusprivate.c:1318)
==26538==    by 0x420D2ED: invoke_caller (gdbusprivate.c:266)
==26538==    by 0x404DA7C: g_idle_dispatch (gmain.c:4224)
==26538==    by 0x4049FCD: g_main_dispatch (gmain.c:2119)
==26538==    by 0x404B2C1: g_main_context_dispatch (gmain.c:2672)
==26538==    by 0x404B716: g_main_context_iterate (gmain.c:2750)
==26538==    by 0x404BE7F: g_main_loop_run (gmain.c:2958)
==26538==    by 0x420D2B5: shared_thread_func (gdbusprivate.c:248)
==26538==    by 0x4077958: g_thread_create_proxy (gthread.c:1897)
==26538==    by 0x57D918: start_thread (pthread_create.c:301)
==26538==    by 0x4C6CBD: clone (clone.S:133)

Bug #627187.
2010-08-18 00:13:41 +02:00
Christian Persch
a91a4a420e Plug a mem leak in gdbus-connection test
==26538== 145 (24 direct, 121 indirect) bytes in 1 blocks are definitely lost in loss record 765 of 790
==26538==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==26538==    by 0x405233C: g_malloc (gmem.c:134)
==26538==    by 0x406A57E: g_slice_alloc (gslice.c:836)
==26538==    by 0x406A60C: g_slice_copy (gslice.c:858)
==26538==    by 0x4035C5A: g_error_copy (gerror.c:160)
==26538==    by 0x41B6387: g_simple_async_result_set_from_error (gsimpleasyncresult.c:638)
==26538==    by 0x41FCDEB: g_dbus_connection_call_done (gdbusconnection.c:4808)
==26538==    by 0x41B682E: g_simple_async_result_complete (gsimpleasyncresult.c:762)
==26538==    by 0x41B686A: complete_in_idle_cb (gsimpleasyncresult.c:772)
==26538==    by 0x404DA7C: g_idle_dispatch (gmain.c:4224)
==26538==    by 0x4049FCD: g_main_dispatch (gmain.c:2119)
==26538==    by 0x404B2C1: g_main_context_dispatch (gmain.c:2672)
==26538==    by 0x404B716: g_main_context_iterate (gmain.c:2750)
==26538==    by 0x404BE7F: g_main_loop_run (gmain.c:2958)
==26538==    by 0x804B5CC: test_connection_send (gdbus-connection.c:407)
==26538==    by 0x4073D04: test_case_run (gtestutils.c:1174)

Bug #627187.
2010-08-18 00:13:41 +02:00
Christian Persch
75563e81c2 Plug a mem leak in gdbus-connection test
==25403== 49 (24 direct, 25 indirect) bytes in 1 blocks are definitely lost in loss record 603 of 787
==25403==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==25403==    by 0x405233C: g_malloc (gmem.c:134)
==25403==    by 0x406A57E: g_slice_alloc (gslice.c:836)
==25403==    by 0x406A5C3: g_slice_alloc0 (gslice.c:848)
==25403==    by 0x4035B4E: g_error_new_literal (gerror.c:117)
==25403==    by 0x4035ED9: g_set_error_literal (gerror.c:314)
==25403==    by 0x41F6434: g_dbus_connection_close_sync (gdbusconnection.c:1284)
==25403==    by 0x804A861: test_connection_life_cycle (gdbus-connection.c:158)
==25403==    by 0x4073D04: test_case_run (gtestutils.c:1174)
==25403==    by 0x4073FC2: g_test_run_suite_internal (gtestutils.c:1223)
==25403==    by 0x4074077: g_test_run_suite_internal (gtestutils.c:1233)
==25403==    by 0x4074077: g_test_run_suite_internal (gtestutils.c:1233)
==25403==    by 0x40741FB: g_test_run_suite (gtestutils.c:1274)
==25403==    by 0x40733E5: g_test_run (gtestutils.c:877)
==25403==    by 0x804DC92: main (gdbus-connection.c:1024)

Bug #627187.
2010-08-18 00:13:41 +02:00
Christian Persch
a62a2fd8ed Plug a mem leak in the gdbus-connection test
Bug #627182.
2010-08-18 00:13:41 +02:00
Christian Persch
7191fc3f17 Use g_memory_output_stream_steal_data here
... instead of one extra g_memdup().

Bug #627181.
2010-08-18 00:13:27 +02:00
Christian Persch
71e73ffdfb Use G_DEFINE_[BOXED|POINTER]_TYPE instead of handwritten code
Now that we have convenience macros to implement boxed and pointer
types, use them.
2010-08-18 00:12:28 +02:00
Christian Persch
cae86073ea Add GZIP header processing to GZlibCompressor/GZlibDecompressor
Add GZlibCompressor:file-info property. If it contains a non-NULL
GFileInfo, and the compressor is in GZIP mode, the filename and
modification time from the file info are written to the GZIP header
in the output data.

Add GZlibDeompressor:file-info property. If the decompressor is in GZIP
mode, and the GZIP data contains a GZIP header, the filename and
modification time are read from it, stored in a GFileInfo, and the
file-info property is notified.

Bug #617691.
2010-08-17 17:37:32 +02:00
Christian Persch
b196cd7447 Add g_memory_output_stream_steal_data
Bug #622184.
2010-08-17 17:33:01 +02:00
David Zeuthen
b8e7ef6e90 Bug 627071 – g_output_stream_write() clarification
This patch guarantees that g_output_stream_write() can never fail with
G_IO_ERROR_WOULD_BLOCK. Without such a guarantee, we would need some
kind of GIOPollable interface or some way to get an event when the
stream is writable again. Which is mostly useless considering that
this method is asynchronous anyway.

Note: this patch just codifies existing behavior - GUnixOutputStream,
GSocketOutputStream and other implementations already work this way.

See also bug 626748 comment 5 for how the GDBus code relies on this
guarantee.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-16 15:38:02 -04:00
David Zeuthen
8a3a4596e2 Bug 626748 – Use async methods for writing and handle EAGAIN
If sending a lot of data and/or the other peer is not reading it, then
socket buffers can overflow. This is communicated from the kernel by
returning EAGAIN. In GIO, it is modelled by g_output_stream_write()
and g_socket_send_message() returning G_IO_ERROR_WOULD_BLOCK.

It is also problematic that that we're using synchronous IO in the
shared GDBus IO thread. It means that one GDBusConnection can lock up
others.

It turns out that by porting from g_output_stream_write() to
g_output_stream_write_async() we fix the EAGAIN issue. For GSocket, we
still need to handle things manually (by creating a GSource) as
g_socket_send_message() is used.

We check the new behavior in Michael's producer/consumer test case (at
/gdbus/overflow in gdbus-peer.c) added in the last commit.

Also add a test case that sends and receives a 20 MiB message.

Also add a new `transport' G_DBUS_DEBUG option so it is easy to
inspect partial writes:

 $ G_DBUS_DEBUG=transport ./gdbus-connection -p /gdbus/connection/large_message
 [...]
 ========================================================================
 GDBus-debug:Transport:
   >>>> WROTE 128000 bytes of message with serial 4 and
        size 20971669 from offset 0 on a GSocketOutputStream
 ========================================================================
 GDBus-debug:Transport:
   >>>> WROTE 128000 bytes of message with serial 4 and
        size 20971669 from offset 128000 on a GSocketOutputStream
 ========================================================================
 GDBus-debug:Transport:
   >>>> WROTE 128000 bytes of message with serial 4 and
        size 20971669 from offset 256000 on a GSocketOutputStream
 [...]
 ========================================================================
 GDBus-debug:Transport:
   >>>> WROTE 43669 bytes of message with serial 4 and
        size 20971669 from offset 20928000 on a GSocketOutputStream
 [...]
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 16 bytes of message with serial 3 and
        size 20971620 to offset 0 from a GSocketInputStream
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 15984 bytes of message with serial 3 and
        size 20971620 to offset 16 from a GSocketInputStream
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 16000 bytes of message with serial 3 and
        size 20971620 to offset 16000 from a GSocketInputStream
 [...]
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 144000 bytes of message with serial 3 and
        size 20971620 to offset 20720000 from a GSocketInputStream
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 107620 bytes of message with serial 3 and
        size 20971620 to offset 20864000 from a GSocketInputStream
 OK

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-16 13:54:13 -04:00
David Zeuthen
a6264a3a19 GSocket: Properly initialize msg.msg_control
This patch fixes this problem

   Syscall param socketcall.sendmsg(msg.msg_control) points to uninitialised byte(s)
      at 0x3D5B00EA60: __sendmsg_nocancel (syscall-template.S:82)
      by 0x53F9790: g_socket_send_message (gsocket.c:2918)
      by 0x540FDD0: g_unix_connection_send_credentials (gunixconnection.c:351)
      by 0x542B93F: _g_dbus_auth_run_client (gdbusauth.c:618)
      by 0x5438001: initable_init (gdbusconnection.c:2191)
      by 0x53E09CC: g_initable_init (ginitable.c:105)
      by 0x543F6E9: g_bus_get_sync (gdbusconnection.c:6091)
      by 0x402C7E: test_connection_life_cycle (gdbus-connection.c:126)
      by 0x4C7CABB: test_case_run (gtestutils.c:1174)
      by 0x4C7CD84: g_test_run_suite_internal (gtestutils.c:1223)
      by 0x4C7CE49: g_test_run_suite_internal (gtestutils.c:1233)
      by 0x4C7CE49: g_test_run_suite_internal (gtestutils.c:1233)
    Address 0x7fefff9fc is on thread 1's stack

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-16 12:30:25 -04:00
Matthias Clasen
4bc4590c7b Declare stream base classes as abstract 2010-08-16 10:21:38 -04:00
Dan Winship
547311bfd8 Always do async vs sync correctly in GSocketConnection streams
Previously if a GSocketConnection had a blocking GSocket, it would
sometimes block during asynchonous I/O, and if it had a non-blocking
socket, it would sometimes return G_IO_ERROR_WOULD_BLOCK from
synchronous I/O. This fixes the connection to not depend on the socket
state.

https://bugzilla.gnome.org/show_bug.cgi?id=616458
2010-08-15 15:34:29 -04:00
Dan Winship
17fea2f749 Belatedly add g_socket_client_get/set_timeout to docs and symbols 2010-08-15 13:11:49 -04:00
Dan Winship
b76b24f1b3 GSocketClient: plug two leaks
g_socket_client_connect_async() was always leaking its GCancellable,
and would also leak any GSocket that eventually failed to connect
after returning G_IO_ERROR_PENDING.
2010-08-14 16:15:39 -04:00
Dan Winship
16bafb4799 GSocketClient: add a timeout property
GSocket has a timeout flag now, but when using GSocketClient there was
no way to set the timeout until after connecting (or failing). Fix
that by adding a timeout property to GSocketClient.
2010-08-14 15:26:16 -04:00
Will Thompson
28a4fff7ec Add examples for GAsyncInitiable and GSimpleAsyncResult
Bug 602417
2010-08-13 23:34:44 -04:00
Will Thompson
7a32e34f7c Document that _complete() et al. ref the GSimpleAsyncResult 2010-08-13 23:20:06 -04:00
Will Thompson
ec31612ea0 _simple_async_result_is_valid: allow tag to be NULL
Because g_simple_async_report_[g]error_in_idle() don't take a source tag
parameter, code that uses them can't currently use
g_simple_async_result_is_valid() (at least, not for the error case).

Bug 602417
2010-08-13 23:15:27 -04:00
Matthias Clasen
e02571e93b Add bug references to some tests 2010-08-13 21:23:23 -04:00
Matthias Clasen
ea8a963936 Document vendor override files
Features without documentation, tsk tsk.
2010-08-13 21:23:22 -04:00
Matthias Clasen
4160c5c74a Add tests for async file replace and load 2010-08-13 19:40:48 -04:00
Matthias Clasen
c003468296 Correct a comment 2010-08-13 17:23:44 -04:00
Matthias Clasen
93bd5298c7 Add an async file create/write/read/delete test 2010-08-13 17:23:44 -04:00
Matthias Clasen
7ed4762190 Fix a typo, and some doc reformatting 2010-08-13 17:23:44 -04:00
Matthias Clasen
effdb785fd Add some long descriptions for filter streams 2010-08-13 17:23:44 -04:00
Matthias Clasen
13e55b84eb Run volumemonitor test with local vfs
This is an attempt to stop the test from hanging on some build bots
in build.gnome.org.
2010-08-13 17:23:44 -04:00
David Zeuthen
d344ff9d67 Bug 626841 – Add test-case for non-socket GIOStream
Also fix a couple of bugs so it actually works.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-13 14:01:36 -04:00
Michael Meeks
9be94e8899 Add test for EAGAIN overflow in gdbusconnection based on David's test. 2010-08-13 17:56:19 +01:00
Matthias Clasen
5d9d3f0318 Add some async file tests 2010-08-13 12:04:21 -04:00
Tor Lillqvist
398f9841ed Fix gio/win32 build after -I flag changes 2010-08-10 16:01:39 +03:00
Matthias Clasen
14e0ad7c53 Don't compile some unused functions in gio/xdgmime/ 2010-08-08 21:32:04 -04:00
Matthias Clasen
584787f580 Improve the async result test coverage 2010-08-08 21:32:03 -04:00
Matthias Clasen
7c129c9011 Improve dbus address test coverage 2010-08-08 21:32:03 -04:00
Matthias Clasen
51ad83f711 Make g_dbus_error_unregister_error work 2010-08-07 18:56:12 -04:00
Matthias Clasen
8e236f7ec1 Add some more test about gdbus_error apis 2010-08-07 18:55:21 -04:00
Matthias Clasen
7de6658f74 Make g_simple_async_result_is_valid work without source
The problem was pointed out by Xavier Claessens in bug 626208.
2010-08-07 17:10:17 -04:00
Matthias Clasen
402ad1958c Make the closure variants of name owning and watching actually work
The GClosure API is a bit funky (and badly documented), and requires
you to set a marshaller on the closure, and the marshaller has an
implicit 'this' argument, and the caller is reponsible for unsetting
the values after invoking the closure.

I've added some calls of the _with_closures variants to the
gdbus-names test now.
2010-08-07 17:10:17 -04:00
Ryan Lortie
b91f9274d9 Fix volumemonitor test case
Don't blindly g_object_unref() that which may be NULL.
2010-08-06 13:12:20 -04:00
Ryan Lortie
889a7f81dd gio.symbols: add g_dbus_message_[gs]et_byte_order 2010-08-06 13:11:38 -04:00
Ryan Lortie
b3b7ea8e22 Replace -I with $(glib_INCLUDES) and friends
Stop using ad hoc -I in all of our Makefile.am.  Use the new variables
instead.
2010-08-06 13:10:34 -04:00
Ryan Lortie
ba0208b3a8 Clean up improper #includes
We have a lot of broken #including going on around the tree.  This has
gone unnoticed due to our sloppy use of -I.
2010-08-06 13:05:18 -04:00
paul
9f6faaffb6 Add $(top_builddir)/glib to includes
This is required to find glibconfig.h during srcdir != builddir builds
2010-08-05 09:08:34 -04:00
David Zeuthen
d52e1c33f7 GDBus: Add `return' debug option
This prints all GDBusMethodInvocation API usage and is normally used
with the `incoming' option. Example:

 # G_DBUS_DEBUG=incoming,return ./polkitd --replace
 Entering main event loop
 Connected to the system bus
 Registering null backend at priority -10
 [...]
 Acquired the name org.freedesktop.PolicyKit1
 [...]

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.26
       serial 299
 ========================================================================
 GDBus-debug:Return:
  >>>> METHOD ERROR org.freedesktop.PolicyKit1.Error.Failed
       message `Cannot determine session the caller is in'
       in response to org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       to name :1.26
       reply-serial 299

 [...]

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.2402
       serial 25
 ========================================================================
 GDBus-debug:Return:
  >>>> METHOD RETURN
       in response to org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       to name :1.2402
       reply-serial 25

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 16:59:26 -04:00
David Zeuthen
89a1b571ad GDBusMessage: Validate header fields when serializing/deserializing
The D-Bus spec mentions exactly what header fields are required for
various message types. Add tests for this as well.

Also disallow empty interfaces for signals since the D-Bus spec says
this is Verboten already.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 14:38:51 -04:00
David Zeuthen
6f070be65b GDBusMessage: Add a way to get/set byte order of a message
Also use this in the test cases to check that serialization to and
from both big and little endian works.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 13:34:14 -04:00
David Zeuthen
6e723e8b3e GDBusMessage: Assert various things when serializing to a blob
We use g_assert() instead of setting the GError because it is a
programming error if the GVariant contains invalid data - see commit
5e6f762d61 for where the last hole in
GVariant was closed.

So if we can trust GVariant to only contain valid data (ignoring the
case where unsafe API such as g_variant_new_from_data() is used), why
g_assert() at all with costly g_utf8_validate() checks? Because a) it
is relatively inexpensive; and b) it helps find bugs such as the one
fixed in commit 5e6f762d61.

If performance is a concern we can play games like introducing
environment variables or other machinery to avoid such "costly"
checks. I doubt it will ever be an issue.

Also replace two "Hmm" TODO item with a static assert - the code that
serializes a gdouble into the D-Bus wire format by treating it as a
guint64 is indeed correct - endianess needs to be taken into account
(see the D-Bus reference implementation for similar code). But we want
to make sure that we're indeed using an architecture/compiler where a
gdouble takes up 8 bytes - hence the assertion.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 12:24:22 -04:00
David Zeuthen
5bd34a820e GDBusMessage: Validate UTF-8 strings when serializing from blob
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 11:26:48 -04:00
Dan Winship
e62bc8e8f6 remove a junk line 2010-08-04 07:36:34 -04:00
David Zeuthen
f5cd8ddeaa GDBusConnection: Debug messages when receiving signals and method invocations
Spell out "RECEIVED SIGNAL" instead of "SIGNAL" to emphasize this is
about receiving a signal, not emitting one (which is "SIGNAL
EMISSION"). Also make the "arrows" point in the "right" direction
("<<<<" vs ">>>>") - like this:

 ========================================================================
 GDBus-debug:Signal:
  <<<< RECEIVED SIGNAL org.freedesktop.DBus.NameOwnerChanged
       on object /org/freedesktop/DBus
       sent by name org.freedesktop.DBus

and

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.EnumerateTemporaryAuthorizations()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.2176

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 15:36:16 -04:00
David Zeuthen
69341e2ba9 glib-compile-schemas: Pass a C string, not a GString wrapper
Commit 5e6f762d61 (introducing UTF-8
validity checks for GVariant instances containing strsings) actually
uncovered a bug in glib-compile-schemas - a GString was passed when a
C string was expected.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 14:32:29 -04:00
David Zeuthen
86d947f01f Fix gdbus-exit-on-close test case
Forgot to update the test case after last commit.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 12:47:07 -04:00
David Zeuthen
6a492a4519 GDBus: If exiting b/c remote peer disconnected and error is set, print it
This should make things easier to debug:

  g_dbus_connection_real_closed: Remote peer vanished with error:
  Underlying GIOStream returned 0 bytes on an async read
  (g-io-error-quark, 0). Exiting.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 12:24:48 -04:00
David Zeuthen
3940cc9a11 GDBusProxy: Don't leak a GSimpleAsyncResult when doing async calls
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 11:14:21 -04:00
Matthias Clasen
b2715bbc5e Fix a possible deadlock
the FdSource was calling g_cancellable_disconnect while holding the
main context lock, which is bad news if the ::cancelled handler is
trying to get that lock to wake up the mainloop...

Bug 586432
2010-08-03 10:41:21 -04:00
Emmanuele Bassi
b3de028a43 Update the Git ignore files 2010-08-03 14:21:02 +01:00
Ryan Lortie
ca3b7b75bf GSettings: add G_SETTINGS_BIND_INVERT_BOOLEAN flag
When binding a boolean setting to a boolean property, invert the values.
This avoids the requirement for writing a pair of mapping functions for
this extremely common case.

Add a test.

https://bugzilla.gnome.org/show_bug.cgi?id=625833
2010-08-03 02:09:10 -04:00
Fridrich Štrba
dd2bbc9533 On windows, export also symbols defined in gio/gwin32appinfo.c 2010-08-02 10:16:29 +02:00
Carlos Garcia Campos
892012b951 GDBusConnection: fix message flags in g_dbus_connection_call_sync()
GDBusCallFlags were used instead of GDBusSendMessageFlags for
g_dbus_connection_send_message_with_reply_sync(). Fixes bug #625753.
2010-08-01 17:27:58 +02:00
Milan Crha
d01a437490 Silence valgrind
Initialize all fields of struct msghdr. Bug 625472.
2010-07-31 23:51:45 -04:00
Matthias Clasen
8246bf4bde Improve gdbus test coverage 2010-07-31 00:13:02 -04:00
Matthias Clasen
116b945c94 Fix a typo
Its credentials, not crendentials
2010-07-30 23:44:30 -04:00
Matthias Clasen
eb3e926b09 Fix an off-by-one error 2010-07-30 19:53:29 -04:00
Matthias Clasen
5033be80d1 Add a test for g_dbus_proxy_get_cached_property_names 2010-07-30 19:51:22 -04:00
Matthias Clasen
aa196c60df Improve coverage of buffered output stream tests 2010-07-30 19:51:21 -04:00
Matthias Clasen
ffa938fc65 Improve coverage of credentials tests 2010-07-30 19:51:21 -04:00
Matthias Clasen
670528c187 Improve coverage of converter stream tests 2010-07-30 19:51:21 -04:00
Matthias Clasen
9794a648a9 Improve coverage of memory stream tests 2010-07-30 19:51:21 -04:00