summaryrefslogtreecommitdiff
path: root/dbus/dbus-gobject.c
AgeCommit message (Collapse)AuthorFilesLines
2011-09-28Fix various minor documentation bugsHEADmasterSimon McVittie1-14/+19
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37793 Bug-NB: related to NB#218973
2011-08-17get_all_object_properties: if _dbus_gvalue_marshal fails, bail outSimon McVittie1-2/+25
This isn't necessarily OOM: _dbus_gvalue_marshal can fail due to programming errors. If so, raise a critical warning, then (if that wasn't fatal) return a D-Bus error to be sent to the caller. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17get_all_object_properties: note which operations can only fail via OOMSimon McVittie1-0/+12
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17get_all_object_properties: skip invalidly-named properties, with a criticalSimon McVittie1-0/+9
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17dbus-gobject: add and use connection_send_or_die to check for OOMSimon McVittie1-15/+25
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Conflicts: dbus/dbus-gobject.c
2011-08-17emit_signal_for_registration: assert that signal headers are all validSimon McVittie1-0/+4
This is an assertion, not a return_if_fail, because we already checked the object path in dbus_g_connection_register_g_object and the others in export_signals. After these checks, dbus_message_new_signal can really only fail on OOM. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17export_signals: check interface, signal names for validitySimon McVittie1-0/+14
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17object_registration_message: check for OOM when a property is absentSimon McVittie1-3/+5
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17object_registration_message: make logic/assertions slightly clearerSimon McVittie1-7/+6
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17object_registration_message: handle remote caller errors betterSimon McVittie1-6/+14
If the remote process sends us a wrong message, that's its fault, not ours; we should send back a comprehensible D-Bus error, and not spam to stderr. Previously, in each of these cases libdbus would have sent back NoReply, because we declined to handle the method call. One case that's still wrong is passing extra arguments to Get, GetAll or Set, like so: Get("com.example.Iface", "MyProperty", "extra") Set("com.example.Iface", "MyProperty", Variant("foo"), "extra") GetAll("com.example.Iface", "extra") dbus-glib has historically warned, ignored the extra argument(s) and sent back a reply as if they hadn't been there, whereas a stricter implementation (like telepathy-glib's TpDBusPropertiesMixin) would have sent back an error reply and done nothing. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17get_object_property: add brief documentationSimon McVittie1-0/+5
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17get_object_property: unwind on errors, and avoid returning NULLSimon McVittie1-10/+23
Also treat all errors here as programming errors (because this method should never fail), upgrading them from warning to critical; return a D-Bus error reply anyway, to be nicer to our callers. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17check_property_access: centralize error handling (and check for OOM)Simon McVittie1-26/+43
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17dbus-gobject: check for NULL when producing messagesSimon McVittie1-3/+3
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Conflicts: dbus/dbus-gobject.c
2011-08-17dbus-gobject: factor out reply_or_die, error_or_die and add error-checkingSimon McVittie1-33/+50
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35766 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17invoke_object_method: if marshalling an out argument fails, discard messageSimon McVittie1-11/+36
We shouldn't report this as OOM, because it probably wasn't (it's much more likely to be programming error); we should also continue through the arguments, so that we don't leak them. By abandoning the message as soon as we detect a programming error, we can use reply == NULL as an indicator of whether to keep appending. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35767 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17invoke_object_method, dbus_g_method_return_error: handle sending failureSimon McVittie1-2/+7
I just made it fatal, since it's either programming error or OOM. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35767 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17gerror_to_dbus_error_message: guarantee to return non-NULLSimon McVittie1-0/+6
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35767 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17invoke_object_method: if dbus_message_new_method_return fails, fail hardSimon McVittie1-1/+3
There's no point in doing graceful unwinding here, since it really shouldn't happen. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35767 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-08-17arg_iterate: documentSimon McVittie1-0/+40
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35767 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-06-16Show warning if marshalling in dbus_g_method_return failsSimon McVittie1-1/+7
Based on a patch from Christian Dywan <christian.dywan@lanedo.com>. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=29884 Bug-NB: NB#180486 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-06-02Fix regression in marshalling objects as object pathsSimon McVittie1-4/+4
This regressed while fixing fd.o #36811. NetworkManager apparently uses this idiom. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37852 Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=628890 Tested-by: Michael Biebl <biebl@debian.org> Reviewed-by: Colin Walters <walters@verbum.org>
2011-06-01Remove Doxygen droppings from source codeSimon McVittie1-2/+1
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=10890
2011-06-01Log error message from failed object registrationDan Williams1-5/+10
See https://bugzilla.redhat.com/show_bug.cgi?id=708686 for a case of this; it would be extremely helpful to figure out what the error actually was since it appears not to be a double-registration or other such issues after inspection of nm-applet and libnm-glib. Reviewed-by: Colin Walters <walters@verbum.org> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37795
2011-05-27dbus-gobject: check various preconditions for methodsSimon McVittie1-3/+26
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=36811
2011-05-27dbus-gobject: move weakref to ObjectExport, with ObjectRegistration pointing ↵Simon McVittie1-30/+59
there This has the following results: * each exported object only needs one weak ref to itself, however many times it is registered * because the ObjectRegistration now points to the ObjectExport, it can always remove itself from the list of registrations even if the actual object has been disposed, avoiding a leak (fd.o #36811) Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=36811
2011-05-27dbus_g_connection_register_g_object: only hook onto signals on first useSimon McVittie1-32/+16
This fixes a bug in which an empty list of registrations was considered to be synonymous with the object never having been exported, resulting in this failure mode: * register object at n locations - the first time, export_signals() is called * unregister all of those locations * register object at a new location - export_signals() is wrongly called again * emit a signal - the D-Bus signal gets emitted twice Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=36811
2011-05-27dbus_g_connection_register_g_object: attach ObjectExport firstSimon McVittie1-11/+9
This means we no longer need the unnecessarily subtle "steal and put back" pattern. Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=36811
2011-05-27dbus-gobject: wrap the GSList of registrations in a simple structSimon McVittie1-26/+51
For simplicity, the ObjectExport struct isn't freed until the object is actually destroyed, even if there are no more registrations. Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=36811
2011-05-17dbus_g_connection_unregister_g_object: only unregister from @connectionSimon McVittie1-2/+6
Previously, we unregistered the object from all connections, if it was present on more than one. Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=32087
2011-05-17fd.o #32087: emit signals on the appropriate connectionsSimon McVittie1-18/+5
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=32087
2011-05-17dbus_g_connection_register_g_object: don't destroy state on early returnSimon McVittie1-4/+8
At the beginning of the function we steal the object's state so we can add to the list. After doing that, we must make sure we give it back! Bug: https://bugs.freedesktop.org/show_bug.cgi?id=36793 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2011-05-17dbus_g_connection_unregister_g_object: fix out-of-bounds readingSimon McVittie1-3/+3
The list of registrations is singly linked; we only avoid a crash here by luck. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=36793 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2011-04-13When given an object path, use GVariant to check syntactic validitySimon McVittie1-1/+1
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=30171
2011-01-04Do not squash underscores in error namesChristian Dywan1-4/+5
Underscores are used and valid according to the specification. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=30274 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2010-10-05Remove unused method attribute variables in introspect_interfacesChristian Dywan1-4/+0
2010-08-11Respect property access flags for writing, allow disabling for readsColin Walters1-41/+252
Because DBus-GLib originally was designed as a generic "object mapping" binding, the handler for org.freedesktop.DBus.Properties simply allowed access (read or write) to any GObject property that was exported. Later, the (compile time) introspection XML was added, and while we only listed "exported" properties in the dynamic introspection XML, we still allowed Get or Set calls to any property that was valid. With this patch, we deny writes to properties which aren't listed in the XML, or are listed as read-only. For backwards compatibility however, we still allow reads. A service may disable this by calling dbus_glib_global_set_disable_legacy_property_access().
2010-07-01Fix lookup of regular properties when shadow properties are usedDan Williams1-1/+2
Only free the uscore converted name if there's actually a shadow property registered for this property; otherwise if there is no shadow property we free the uscore converted one and then return it immediately after.
2010-05-04fd.o #27958: dbus_g_error_domain_register: rewrite the documentationSimon McVittie1-5/+25
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
2010-04-26core: don't pass malformed error interface to dbus (rh#581794)Dan Williams1-6/+11
While clients should really register their errors, dbus-glib shouldn't be passing a malformed error interface to dbus either. It's just not nice and libdbus will call abort(). See https://bugzilla.redhat.com/show_bug.cgi?id=581794 Signed-off-by: Colin Walters <walters@verbum.org>
2010-04-19Allow duplicate object path registrations for different connectionsAstone Lin1-1/+1
We clearly need to respect the connection when comparing registrations, since it's perfectly valid to have the same one on two different connections.
2010-03-24core: performance optimization for object info lookupDan Williams1-13/+18
2010-03-24core: allow duplicate property names on GInterfacesDan Williams1-17/+143
Allows dbus-glib clients to handle objects that implement more than one interface with the properties of the same name. Normally this would not be allowed since with GObject all properties are in the same namespace. This patch allows the interface to register "shadow" properties on a per-interface basis which redirect the lookup of the property name.
2010-03-24[dbus-gobject.c] Trivial compiler warning fixesColin Walters1-2/+1
2010-03-16Free errors returned by method implementationsWill Thompson1-0/+4
https://bugs.freedesktop.org/show_bug.cgi?id=26981
2010-03-08turn the gtk-doc documentation into buildable shapeSven Herzberg1-3/+3
* dbus/dbus-gobject.c: the < and > symbols broke the sgml generation in gtk-doc
2010-03-02Fix hyphenated error codes correctlyColin Walters1-3/+18
The error code names generated my glib-mkenums separate the words by hyphens which are invalid D-BUS error names. This patch converts them back to wincaps, but we can't uppercase the first letter. Based on an original patch from Neil Roberts <neil@linux.intel.com>
2010-03-02Revert "Squash underscores and dashes in errors when converting to DBus errors"Colin Walters1-11/+2
This reverts commit 9637ed9f0c66982a06048b18ccf983881643e456. This incorrectly uppercased the first character in error names: https://bugzilla.redhat.com/show_bug.cgi?id=569631
2010-02-15Squash underscores and dashes in errors when converting to DBus errorsColin Walters1-2/+11
We were just taking the enumeration nick and appending to the DBus error name, but since these can contain '-' we need to squash.
2009-11-25Merge remote branch 'upstream/master'Simon McVittie1-7/+10