summaryrefslogtreecommitdiff
path: root/gdbus/object.c
AgeCommit message (Collapse)AuthorFilesLines
2014-07-17Imported Upstream version 1.24upstream/1.24Zhang zhengguang1-75/+115
2013-02-23gdbus: Always unreference the message in g_dbus_send_message()Tomasz Bursztyka1-2/+3
A quick fix on g_dbus_send_message(), if check_signal() fails it returns FALSE without unreferencing the message as it should. This patch fixes it.
2013-02-14gdbus: Fix missing PropertiesChanged signalVinicius Costa Gomes1-2/+5
If D-Bus ObjectManager is not supported, InterfacesAdded signal checking needs to be ignored otherwise PropertiesChanged signal will never be sent.
2013-02-01gdbus: Fix unpublished interface signal emissionJohan Hedberg1-0/+4
If we haven't published an interface yet (i.e. it's in the data->added list), we should just ignore any property changed indications as the values for the properties will anyway be part of the InterfacesAdded signal.
2013-01-20gdbus: Check for valid path before handling propertiesMarcel Holtmann1-0/+6
2013-01-06gdbus: Fix memory leak on properties_set()Anderson Lizardo1-1/+6
The pointer returned by dbus_message_iter_get_signature() must be freed with dbus_free(). Fixes this memory leak: ==1857== 16 bytes in 1 blocks are definitely lost in loss record 104 of 251 ==1857== at 0x402BF52: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==1857== by 0x415E286: dbus_realloc (in /lib/i386-linux-gnu/libdbus-1.so.3.5.8) ==1857== by 0x415E70B: ??? (in /lib/i386-linux-gnu/libdbus-1.so.3.5.8) ==1857== by 0x415F17B: ??? (in /lib/i386-linux-gnu/libdbus-1.so.3.5.8) ==1857== by 0x414CB33: dbus_message_iter_get_signature (in /lib/i386-linux-gnu/libdbus-1.so.3.5.8) ==1857== by 0x8053239: properties_set (object.c:899) ==1857== by 0x5FFFFF: ??? ==1857==
2013-01-05gdbus: Check signature of property value before calling setterMarcel Holtmann1-0/+5
2013-01-03gdbus: Don't include just added interfaces in GetManagedObjectsLucas De Marchi1-1/+7
If we received a call to ObjectManager.GetManagedObject we should not include in the response the interfaces in data->added. This is because it's not guaranteed that those interfaces will trigger an InterfacesAdded signal, which is the case if the interface is removed in the same mainloop iteration.
2013-01-03gdbus: Simplify generated introspectionLucas De Marchi1-65/+38
The generated introspection is not supposed to be read as is by human, so there's no point in printing the indentation or writing more code to use auto-close tags. If it's desired to read the raw xml file, user can always use other tools to transform the output such as "xmllint --format". This also fixes a missing </property> when property is deprecated.
2012-12-30gdbus: Call check_signals when sending signals with g_dbus_send_messageLuiz Augusto von Dentz1-0/+9
If message passed to g_dbus_send_message is a signal verify if it is a valid and there really exists an interface with respective signal name.
2012-12-30gdbus: Check if the interface being registered is validLuiz Augusto von Dentz1-6/+36
This prevent registering interfaces that are empty or have all members marked as experiemental.
2012-12-30gdbus: Introduce G_DBUS_PROPERTY_FLAG_EXPERIMENTALLuiz Augusto von Dentz1-17/+31
This flag can be used to mark properties as experimental, marked properties are disabled by default and can be enabled by setting G_DBUS_FLAG_ENABLE_EXPERIMENTAL using g_dbus_set_flags.
2012-12-30gdbus: Introduce G_DBUS_SIGNAL_FLAG_EXPERIMENTALLuiz Augusto von Dentz1-3/+16
This flag can be used to mark signals as experimental, marked signals are disabled by default and can be enabled by setting G_DBUS_FLAG_ENABLE_EXPERIMENTAL using g_dbus_set_flags.
2012-12-30gdbus: Introduce G_DBUS_METHOD_FLAG_EXPERIMENTALLuiz Augusto von Dentz1-0/+21
This flag can be used to mark methods as experimental, marked methods are disable by default and can be enabled by setting G_DBUS_FLAG_ENABLE_EXPERIMENTAL using g_dbus_set_flags.
2012-12-30gdbus: Include changed properties only once per signalMarcel Holtmann1-0/+3
2012-12-19gdbus: Add helper for sending async error repliesMarcel Holtmann1-0/+32
2012-11-29gdbus: Don't automatically attach ObjectManagerLucas De Marchi1-21/+33
Let each project attach the object manager interface instead of registering it automatically.
2012-11-29gdbus: Don't register DBus.Properties with no propertiesLucas De Marchi1-3/+6
Delay registering DBus.Properties interface until the moment there are properties on that path. This is needed for objects that currently don't expose any property to not export the interface.
2012-11-26gdbus: Replace leading spaces with tabsSyam Sidhardhan1-4/+4
Trivial formatting fix.
2012-11-26gdbus: Fix compilation error due to missing #definesSyam Sidhardhan1-0/+8
Since these are simple #define strings, we are defining it here instead of upgrading to D-Bus 1.5 or later. Log: CC gdbus/object.o gdbus/object.c: In function ‘properties_set’: gdbus/object.c:876:7: error: ‘DBUS_ERROR_UNKNOWN_PROPERTY’ undeclared (first use in this function) gdbus/object.c:876:7: note: each undeclared identifier is reported only once for each function it appears in gdbus/object.c:881:6: error: ‘DBUS_ERROR_PROPERTY_READ_ONLY’ undeclared (first use in this function) make[1]: *** [gdbus/object.o] Error 1 make: *** [all] Error 2
2012-11-26gdbus: Remove connection from pending_property functionsLucas De Marchi1-12/+12
The reply to a DBus.Properties.Set() method call should go through the same D-Bus connection. Thus remove the DBusConnection parameter from the following functions: - g_dbus_pending_property_success() - g_dbus_pending_property_error_valist() - g_dbus_pending_property_error()
2012-11-26gdbus: Fix invalid memory access during interface removalJohan Hedberg1-6/+6
If an interface is removed from the root path during the same mainloop iteration that it was added we need to check for data->added before doing the check for data->parent == NULL in the remove_interface() function. Otherwise the added interface doesn't get removed from the data->added list and will result in accessing freed memory: ==337== Invalid read of size 8 ==337== at 0x4F65AFA: dbus_message_iter_append_basic (in /usr/lib64/libdbus-1.so.3.7.1) ==337== by 0x1247B5: append_interface (object.c:556) ==337== by 0x4C8DC5C: g_slist_foreach (gslist.c:840) ==337== by 0x1261F7: process_changes (object.c:594) ==337== by 0x126372: generic_unregister (object.c:997) ==337== by 0x4F69669: ??? (in /usr/lib64/libdbus-1.so.3.7.1) ==337== by 0x4F5CE51: dbus_connection_unregister_object_path (in /usr/lib64/libdbus-1.so.3.7.1) ==337== by 0x125E81: object_path_unref (object.c:1236) ==337== by 0x126136: g_dbus_unregister_interface (object.c:1361) ==337== by 0x14CDF0: service_exit (service.c:581) ==337== by 0x177556: plugin_cleanup (plugin.c:242) ==337== by 0x12221F: main (main.c:559) ==337== Address 0x5bc1550 is 0 bytes inside a block of size 56 free'd ==337== at 0x4A079AE: free (vg_replace_malloc.c:427) ==337== by 0x4C7850E: g_free (gmem.c:252) ==337== by 0x125DB0: remove_interface (object.c:671) ==337== by 0x125E3B: object_path_unref (object.c:1230) ==337== by 0x126136: g_dbus_unregister_interface (object.c:1361) ==337== by 0x14CDF0: service_exit (service.c:581) ==337== by 0x177556: plugin_cleanup (plugin.c:242) ==337== by 0x12221F: main (main.c:559)
2012-11-26gdbus: Add g_dbus_get_properties functionJohan Hedberg1-0/+19
This function can be used to construct custom D-Bus messages containing the properties for a specific interface on a given path.
2012-11-26gdbus: Add support for invalidated propertiesJohan Hedberg1-1/+14
If there's a pending property but its exists() callback returns false the property should be considered invalidated and included in the relevant list of the PropertiesChanged signal.
2012-11-26gdbus: Fix processing pending properties in remove_interface()Johan Hedberg1-0/+2
2012-11-26gdbus: Fix up Properties.Set() code pathLucas De Marchi1-3/+7
Minor fixes to make setter actually work: - Add propdata in pending_property_set - Break loop when we are removing propdata from list and we found it - in_args and out_args were swapped - interface and method name arguments were swapped
2012-11-26gdbus: Fix invalid memory access while unregisteringLucas De Marchi1-0/+11
If an interface is added and removed on the same mailoop iteration, ObjectManager would try to send InterfacesAdded signal while running the idler because the interface was added to data->added list. This is easily reproduced by forcing an error path in a plugin registration, like on sap_server_register(), resulting in the following error: ==11795== Invalid read of size 4 ==11795== at 0x496F592: dbus_message_iter_append_basic (dbus-message.c:2598) ==11795== by 0x117B39: append_interface (object.c:554) ==11795== by 0x48955E7: g_slist_foreach (gslist.c:840) ==11795== by 0x11923B: process_changes (object.c:592) ==11795== by 0x11956D: generic_unregister (object.c:980) ==11795== by 0x4973BAC: _dbus_object_tree_unregister_and_unlock (dbus-object-tree.c:516) ==11795== by 0x4965240: dbus_connection_unregister_object_path (dbus-connection.c:5776) ==11795== by 0x1178A5: object_path_unref (object.c:1219) ==11795== by 0x118517: g_dbus_unregister_interface (object.c:1344) ==11795== by 0x19AF5B: sap_exit (sap.c:385) ==11795== by 0x13E9E2: sap_server_register (server.c:1428) ==11795== by 0x13C092: sap_server_probe (manager.c:44) With this patch we don't send the InterfacesAdded signal, removing it from data->added while unregistering.
2012-11-26gdbus: Implement PropertiesChanged signalLucas De Marchi1-2/+106
2012-11-26gdbus: Simplify code for appending propertiesLuiz Augusto von Dentz1-32/+2
This reuse append_properties for GetAll and GetManagedObjects
2012-11-26gdbus: Integrates ObjectManager with Properties interfaceLuiz Augusto von Dentz1-1/+27
This appends the properties and its values when using ObjectManager.
2012-11-26gdbus: Only export ObjectManager interface on root pathLuiz Augusto von Dentz1-2/+15
ObjectManager should be exported only in the root path and list all the children paths.
2012-11-26gdbus: Group interface changes to reduce the amount of signals emittedLuiz Augusto von Dentz1-154/+208
InterfacesAdded and InterfacesRemoved can group all the interfaces changes together in one message.
2012-11-26gdbus: Add support for org.freedesktop.DBus.ObjectManager interfaceLuiz Augusto von Dentz1-10/+237
This implements initial support for ObjectManager, it automatically adds objects to its parents so no action is needed by daemons to get their objects managed by this interface. ObjectManager is part of D-Bus spec since revision 0.17: http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager
2012-11-26gdbus: Add properties into Introspectable interfaceLucas De Marchi1-0/+19
2012-11-26gdbus: Implement DBus.Properties.Set methodLucas De Marchi1-1/+141
Contrary to Get() and GetAll(), Set() is asynchronous so we pass an id to the setter so later it can declare the Set() as successful or otherwise.
2012-11-26gdbus: Implement DBus.Properties.GetAll methodLucas De Marchi1-1/+55
2012-11-26gdbus: Implement DBus.Properties.Get methodLucas De Marchi1-1/+61
2012-11-26gdbus: Add skeleton of DBus.Properties interfaceLucas De Marchi1-0/+46
This interface is responsible for handling properties of all objects in a given path. Right now it only registers itself, doing nothing useful. A conversion to this new layout will be done by subsequent patches. org.freedesktop.org.DBus.Properties spec can be found at http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties
2012-11-26gdbus: Use macros to add annotationsLucas De Marchi1-12/+28
Besides being more readable this way it avoids going over 80 chars.
2012-08-27gdbus: Fix compilation error if macro "error" is definedJaganath Kanakkassery1-2/+2
The variable "signature" used in error is not defined and "args" is now a struct instead of a string.
2012-05-22gdbus: Fix incorrectly discarded signalsMikel Astiz1-7/+3
Signals with no arguments were incorrectly filtered out due to the NULL inequality check.
2012-05-18gdbus: do not check signature twiceLucas De Marchi1-5/+0
Message signature is already checked in generic_message(), so there's no need to check again in the callback.
2012-05-18gdbus: add Method.NoReply annotation in introspectionLucas De Marchi1-1/+6
2012-05-18gdbus: add Deprecated annotation in introspectionLucas De Marchi1-2/+17
2012-05-18gdbus: remove signature and reply from tablesLucas De Marchi1-1/+1
2012-05-18gdbus: loop over args to check message signatureLucas De Marchi1-7/+27
2012-05-18gdbus: use GDBusArgInfo to generate introspectionLucas De Marchi1-61/+14
By using GDBusArgInfo in methods and signals, the introspection generation is much simpler and we can add each argument name.
2012-05-18gdbus: add and use helpers for table declarationsLucas De Marchi1-1/+2
2012-05-17gdbus: Constify introspection method tableMarcel Holtmann1-1/+1
2012-05-17gdbus: do not call memset for terminating NULLucas De Marchi1-1/+2