summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Roberto de Souza <jose.souza@intel.com>2013-11-29 17:21:14 -0200
committerJosé Roberto de Souza <jose.souza@intel.com>2013-11-29 17:21:14 -0200
commit64687356b087277e501a59de5a97bc6989e31093 (patch)
treee040e32add9ac560db4407dcb3bbbbcc2c96e897
parentb25fd77827f0e7232fc862fc69e5c595fe9dfcd1 (diff)
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
-rw-r--r--src/lib/eldbus/eldbus_proxy.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/eldbus/eldbus_proxy.c b/src/lib/eldbus/eldbus_proxy.c
index 9f027514d..fcd553aa9 100644
--- a/src/lib/eldbus/eldbus_proxy.c
+++ b/src/lib/eldbus/eldbus_proxy.c
@@ -728,13 +728,23 @@ _property_iter(void *data, const void *key, Eldbus_Message_Iter *var)
}
static void
-_props_get_all(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
+_on_monitored_proxy_del(void *data, Eldbus_Proxy *proxy EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Eldbus_Pending *pending = data;
+ eldbus_pending_cancel(pending);
+}
+
+static void
+_props_get_all(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
Eldbus_Proxy *proxy = data;
Eldbus_Message_Iter *dict;
const char *name, *error_msg;
Eldbus_Proxy_Event_Property_Loaded event;
+ eldbus_proxy_event_callback_del(proxy, ELDBUS_PROXY_EVENT_DEL,
+ _on_monitored_proxy_del, pending);
+
if (eldbus_message_error_get(msg, &name, &error_msg))
{
ERR("Error getting all properties of %s %s, error message: %s %s",
@@ -760,6 +770,7 @@ _props_get_all(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EI
EAPI Eina_Bool
eldbus_proxy_properties_monitor(Eldbus_Proxy *proxy, Eina_Bool enable)
{
+ Eldbus_Pending *pending;
ELDBUS_PROXY_CHECK_RETVAL(proxy, EINA_FALSE);
if (proxy->monitor_enabled == enable)
return proxy->props ? !!eina_hash_population(proxy->props) : EINA_FALSE;
@@ -787,7 +798,9 @@ eldbus_proxy_properties_monitor(Eldbus_Proxy *proxy, Eina_Bool enable)
if (!proxy->props)
proxy->props = eina_hash_string_superfast_new(_props_cache_free);
- eldbus_proxy_property_get_all(proxy, _props_get_all, proxy);
+ pending = eldbus_proxy_property_get_all(proxy, _props_get_all, proxy);
+ eldbus_proxy_event_callback_add(proxy, ELDBUS_PROXY_EVENT_DEL,
+ _on_monitored_proxy_del, pending);
if (proxy->properties_changed)
return !!eina_hash_population(proxy->props);