Commit Graph

88 Commits

Author SHA1 Message Date
Chris Michael baf998165a eldbus: Fix formatting
Summary: No functional changes, just formatting

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-02-11 15:29:29 -05:00
Guilherme Lepsch ef6456c541 eldbus: refactoring code.
Summary:
Code smells: Don't Repeat Yourself

Depends on D1927

Reviewers: felipealmeida, larryolj, cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1928

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-09 22:03:19 +01:00
Guilherme Lepsch c5c70e54fc eldbus: eina_value not allocated from mempool.
Summary: Eina_Value must be allocated with eina_value_new() to be freed by eina_value_free().
@fix

Reviewers: felipealmeida, larryolj, cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1927

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-05 15:37:15 +01:00
Guilherme Lepsch cd0cca6f80 eldbus: fix memory leak.
Summary:

@fix

Reviewers: felipealmeida, larryolj, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1920

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-05 11:28:37 +01:00
Guilherme Lepsch 629b5e3d2b eldbus: production code inside Eina Safety Check assert.
Summary: Eina Safety Checks assert macros don't do anything (no-op) if EINA_SAFETY_CHECKS is undefined.

@fix

Reviewers: felipealmeida, larryolj, cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1926

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-05 11:23:44 +01:00
José Roberto de Souza 63abe9b00c eldbus: Fix crash when removing the last reference of the message container inside of the message callback
If user try to remove the last reference of proxy, object, connection
or eldbus(lib) inside of message callback it was causing the
eldbus_pending_dispatch() being called 2 times, one because of the
eldbus_cancel() that is triggered when the last reference of the
message parent is removed and another after the return of the user
callback.

==6545== Invalid read of size 8
==6545==    at 0x52F784E: eldbus_cbs_free_dispatch (eldbus_core.c:266)
==6545==    by 0x53064AA: eldbus_pending_dispatch (eldbus_pending.c:227)
==6545==    by 0x5305961: cb_pending (eldbus_pending.c:74)
==6545==    by 0x6B29DB1: ??? (in /usr/lib/libdbus-1.so.3.8.9)
==6545==    by 0x6B2D280: dbus_connection_dispatch (in /usr/lib/libdbus-1.so.3.8.9)
==6545==    by 0x52F93B4: eldbus_idler (eldbus_core.c:773)
==6545==    by 0x4E4B300: _ecore_call_task_cb (ecore_private.h:305)
==6545==    by 0x4E4B78F: _ecore_idler_all_call (ecore_idler.c:143)
==6545==    by 0x4E4EA73: _ecore_main_loop_spin_core (ecore_main.c:1768)
==6545==    by 0x4E4EAF1: _ecore_main_loop_spin_timers (ecore_main.c:1802)
==6545==    by 0x4E4ED01: _ecore_main_loop_iterate_internal (ecore_main.c:1925)
==6545==    by 0x4E4D03B: ecore_main_loop_begin (ecore_main.c:983)
==6545==  Address 0x701aa78 is 104 bytes inside a block of size 128 free'd
==6545==    at 0x4C2B200: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6545==    by 0x530655B: eldbus_pending_dispatch (eldbus_pending.c:241)
==6545==    by 0x5306763: eldbus_pending_cancel (eldbus_pending.c:259)
==6545==    by 0x52F29DB: _eldbus_proxy_clear (eldbus_proxy.c:146)
==6545==    by 0x52F3057: _eldbus_proxy_unref (eldbus_proxy.c:244)
==6545==    by 0x52F3393: eldbus_proxy_unref (eldbus_proxy.c:264)
==6545==    by 0x401039: on_get_playlists (banshee.c:53)
==6545==    by 0x5306493: eldbus_pending_dispatch (eldbus_pending.c:225)
==6545==    by 0x5305961: cb_pending (eldbus_pending.c:74)
==6545==    by 0x6B29DB1: ??? (in /usr/lib/libdbus-1.so.3.8.9)
==6545==    by 0x6B2D280: dbus_connection_dispatch (in /usr/lib/libdbus-1.so.3.8.9)
==6545==    by 0x52F93B4: eldbus_idler (eldbus_core.c:773)

Now we will remove the pending from parent pending list before
call the user callback, this way only the pending messages will
be canceled.

Also we need increase the eldbus reference before call
dbus_connection_dispatch() or user could remove the last reference of
eldbus inside of a message callback when we still are
holding one reference of the connection.

@fix
ref T1908
2014-12-17 17:05:35 -02:00
José Roberto de Souza 78d5bb17d7 Revert "eldbus hackaround for proxy deletion during pending callback"
This reverts commit 6a08788d59.

This will be properly fixed on the next patch.
2014-12-17 16:58:25 -02:00
Chris Michael 6e46642dfb eldbus: Fix possible null dereference reported by Coverity
Summary: Fix Coverity CID1256952: reports a null derefence here due to
eldbus_message_new returning NULL, thus causing a null dereference
when trying to set reply->dbus_msg

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-10 13:24:54 -05:00
Mike Blumenkrantz 6a08788d59 eldbus hackaround for proxy deletion during pending callback
this is merely a way to avoid crashing immediately when the referenced bug is triggered. it does not fix the problem.

ref T1908
2014-12-08 15:14:24 -05:00
José Roberto de Souza dfb60c0bfe eldbus: Use the timeout parameter on eldbus_proxy_send_and_block()
Sorry by bad I had forgot to use the new parameter.
2014-12-05 13:06:39 -02:00
José Roberto de Souza b9c1dfdf03 eldbus: Add timeout parameter to eldbus_proxy_send_and_block()
As all other send functions have, we need to have here.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-05 09:53:08 -05:00
José Roberto de Souza 8b193c145e eldbus: Fix _eldbus_connection_send_and_block()
Some problems with the actual implementation:
- the reply should not be writable, as it can only be read.
- if an error happen dbus_connection_send_with_reply_and_block()
will return NULL so we need check before use it
- all other send calls remove one reference of the message

Now also it is creating a error message, so the caller can know why it fail.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-05 09:53:08 -05:00
Chris Michael e62dfdd79e eldbus: Add actual API function code for eldbus_proxy_send_and_block
Summary: This adds the actual code to send a dbus message and block
while waiting for a reply.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-04 09:49:02 -05:00
Chris Michael 34dd248551 eldbus: Add code for _eldbus_connection_send_and_block function
Summary: This function will send a message to dbus and block while
waiting for a reply

NB: This is needed for our 'port to libinput', and for our 'opening up the
drm card without systemd' efforts

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-04 09:49:02 -05:00
Chris Michael 14332f5d0d eldbus: Add API function declaration for eldbus_proxy_send_and_block
Summary: This adds a public facing API function to make dbus calls
which will block and wait for a reply. This is needed for a couple of
use cases in our Wayland efforts (libinput, etc).

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-04 09:49:02 -05:00
Chris Michael 7e7a715164 eldbus: Add function prototype for send_and_block
Summary: This just adds the function prototype into the eldbus private
header. It will be used in the new proxy function
"eldbus_proxy_send_and_block"

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-04 09:49:02 -05:00
Pierre Le Magourou ebaba7f20a eldbus: Fix wrong comments. 2014-10-21 23:42:03 +02:00
Pierre Le Magourou f50f321562 eldbus: update missing eldbus_proxy API documentation. 2014-10-20 18:32:28 +02:00
Pierre Le Magourou a86a8e1e4a eldbus: update missing eldbus_pending.h API documentation. 2014-10-20 18:32:28 +02:00
Pierre Le Magourou 321f6482cd eldbus: update missing eldbus_object API documentation. 2014-10-20 18:32:28 +02:00
Pierre Le Magourou de5e028d7d eldbus: update missing eldbus_message API documentation. 2014-10-20 18:32:28 +02:00
Pierre Le Magourou 11b875b6ce eldbus: update missing eldbus_freedesktop.h API documentation. 2014-10-20 18:32:28 +02:00
Pierre Le Magourou 163773ff9f eldbus: update missing API documentation. 2014-10-20 18:32:27 +02:00
Pierre Le Magourou 65db5e981b eldbus: add missing API documentation in Eldbus.h. 2014-10-20 18:32:27 +02:00
Nicolas Aguirre f15d462737 eldbus: add documentation for Eldbus_Version structure. 2014-10-20 18:02:10 +02:00
Stefan Schmidt 7d4c063fbb eldbus: Only call va_end() if the signature does not match after rewrite
If git log is right this is patch number 4 for this CID. Lets hope we handle all
cases for starting and ending va now.

CID 1039883
2014-09-04 10:35:05 +02:00
Carsten Haitzler 7957721849 eldbus - fix missing varags va_end
fix CID 1039883
2014-09-01 19:40:47 +09:00
Carsten Haitzler 463f5a29f9 eldbus - fix varargs usage - missing va_end on return
this fixes CID 1039883
2014-08-25 11:50:36 +09:00
Carsten Haitzler e263af08c9 eldbus - fix varargs missing end in iter get and next
there was an error return handler that would return without doing
va_end(). coverity picked this up. this fixes CID 1039883
2014-08-14 18:53:40 +09:00
Wonguk Jeong f796679af6 eldbus: do not ignore numeric "0" in property_set
"0" value was considered to be error even if signature was numeric

@fix
2014-08-10 22:55:38 +02:00
Felipe Magno de Almeida 835b8756ec Fixes ABI breakage in Eldbus for use with C++ Eldbus
Summary:
This fixes the breakage when Eldbus_Service_Interface_Desc added a
wrongfully methods2 field to a class that is allocated by the user.

This patch adds the respective eldbus_service_interface_register2 and
eldbus_service_interface_fallback_register2 for registration of
Eldbus_Service_Interface_Desc2 which is now versioned. So future the
functions can be backwards compatible and the struct be forward
compatible and leaves the Eldbus_Service_Interface_Desc and
eldbus_service_interface_register and
eldbus_service_interface_fallback_register intact as it was in EFL
1.10.

This fixes T1408

Reviewers: cedric, stefan_schmidt, raster

Reviewed By: raster

Subscribers: cedric

Maniphest Tasks: T1408

Differential Revision: https://phab.enlightenment.org/D1188
2014-07-15 08:01:14 +09:00
Carsten Haitzler fc2c00c67b fix eldbus warnings 2014-07-08 12:45:44 +09:00
Felipe Magno de Almeida 1baf9e4825 eldbus: Fixes ABI break in Eldbus_Method with appended void* data
Summary:
Removed the void* data variable from Eldbus_Method and created another
struct that has the void* data and added an array of Eldbus_Method2 in
the descriptor for the Eldbus_Service_Interface_Desc and making the
appropriate modifications in the implementation to use both
descriptions.

Reviewers: cedric, stefan_schmidt, raster

CC: cedric

Maniphest Tasks: T1408

Differential Revision: https://phab.enlightenment.org/D1139
2014-07-08 11:57:08 +09:00
Felipe Magno de Almeida 30df128be5 eldbus-cxx: Implementation of eldbus C++ API
Summary:
Applications can:

  void method_callback(void* data, const Eldbus_Service_Interface* iface,
                       const Eldbus_Message* message);
  struct { ... } data_struct;

  Eldbus_Method methods[] =
   {
     "method1", ELDBUS_ARGS("b", "bool"), ELDBUS_ARGS("b", "bool"), ELDBUS_METHOD_FLAG_HAS_DATA
     , (Eldbus_Method_Cb)&method_callback, &data_struct
   };

   And method_callback will be called with data parameter pointing to data_struct global object.

Also, Eldbus-cxx supports registering an interface passing a lambda or
function object as method. For example:

  edb::service_interface iface = edb::service_interface_register
    (c, path, interface
     , es::method("SendStringAndBool"
                  , [expected_string, expected_bool] (std::string const& n, bool b
                                                      , bool* out)
                  {
                    std::cout << "Running SendStringAndBool" << std::endl;
                    ck_assert(n == expected_string);
                    ck_assert(b == expected_bool);
                    *out = b;
                    return n;
                  }
                  , es::ins<std::string, bool>("string", "bool")
                  , es::outs<std::string, bool>("string", "bool")
                  )
    );

When a request for "SendStringAndBool" with the proper signature is
called, executes the lambda and replies with the return value and
its bool* out parameter value.

Reviewers: cedric, woohyun, raster

CC: savio, cedric

Differential Revision: https://phab.enlightenment.org/D1052
2014-07-03 16:28:23 +09:00
Jérémy Zurcher f8c2c57406 do not use EINA_FALSE instead of NULL 2014-05-07 17:45:11 +02:00
Carsten Haitzler 86d9b4ed71 Registers a fallback handler for a given subsection of the object hierarchy.
Summary:
Goal of this patch is cover in Eldbus library function dbus_connection_register_fallback.
http://dbus.freedesktop.org/doc/api/html/group__DBusConnection.html#gac4473b37bfa74ccf7459959d27e7bc59

Reviewers: stanluk, raster

Reviewed By: raster

Differential Revision: https://phab.enlightenment.org/D479
2014-01-23 15:45:22 +09:00
Daniel Juyung Seo 76d8532b54 efl: Unified eina critical manro to CRI.
Being annoyed by different types of eina critical macros - CRI, CRIT,
 CRITICAL -, I concluded to unify them to one. Discussed on IRC and
 finally, CRI was chosen to meet the consistency with other macros -
 ERR, WRN, INF, DBG - in terms of the number of characters.
If there is any missing bits, please let me know.
2013-12-26 12:27:13 +09:00
Cedric BAIL 0a6ce62bb2 eldbus: don't do a double initialization due to ecore module using eldbus now. 2013-12-23 11:24:49 +09:00
Sebastian Dransfeld 6f56406f59 eldbus: Check return value of eina_value_pget
If eina_value_pget returns FALSE, we shouldn't continue.

Fixes CID 1039685
2013-12-07 21:11:33 +01:00
Sebastian Dransfeld 2b9710431e eldbus: use alloca to allocate local mem
Since we free the allocated mem some lines down, we can use alloca. This
also fixes CID 1039179
2013-12-07 21:11:33 +01:00
Sebastian Dransfeld 831d17a8e8 eldbus: unref msg on error
If we return here, the msg isn't sent, so unref it.

Fixes CID 1039178
2013-12-07 21:11:33 +01:00
Sebastian Dransfeld c5caea03e3 eldbus: on error unref msg
This is done on all other errors, EINA_SAFETY macros ain't no silver
bullet.

Fixes CID 1039177
2013-12-07 21:11:33 +01:00
Sebastian Dransfeld f950e7990f eldbus: free allocated mem on error
Fixes CID 1039177
2013-12-07 21:11:33 +01:00
Sebastian Dransfeld 1d1feea572 eldbus: Check return value of _type_size
_type_size could return 0, which would fail in the modulo call next.
Check for 0, and return.

Fixes CID 1039436
2013-12-07 21:11:32 +01:00
Carsten Haitzler 0b605c5daa Eldbus: added function for getting bus unique name
Summary:
Hello guys,

We are now working on a accessibility support for elementary (ATSPI2) and we need following function to correctly register application.

Reviewers: cedric, raster, lucasdemarchi

Reviewed By: raster

Differential Revision: https://phab.enlightenment.org/D327
2013-12-02 14:57:07 +09:00
José Roberto de Souza 64687356b0 eldbus: Fix crash caused when the object of an monitored proxy is deleted
This happen because proxy was already freed and we try print some information
about the proxy in error message.

This fix: https://phab.enlightenment.org/T543
2013-11-29 17:21:14 -02:00
José Roberto de Souza b25fd77827 Revert "workaround for T543"
This reverts commit b663b5b8c7.
2013-11-29 16:39:10 -02:00
Mike Blumenkrantz b663b5b8c7 workaround for T543
this prevents crashing in efm:u2, but is really bad and needs to be fixed more competently before release
2013-11-21 14:44:43 -05:00
Carsten Haitzler b07c0a76ce alpha1 release autofoo/build tree work to pass distcheck and actually work 2013-11-04 18:33:35 +09:00
José Roberto de Souza 2266bf8904 eldbus: Use FDO error message to timeout 2013-09-19 15:47:22 -03:00