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
Diffstat (limited to '')
-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 9f027514d9..fcd553aa97 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)
728} 728}
729 729
730static void 730static void
731_props_get_all(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED) 731_on_monitored_proxy_del(void *data, Eldbus_Proxy *proxy EINA_UNUSED, void *event_info EINA_UNUSED)
732{
733 Eldbus_Pending *pending = data;
734 eldbus_pending_cancel(pending);
735}
736
737static void
738_props_get_all(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
732{ 739{
733 Eldbus_Proxy *proxy = data; 740 Eldbus_Proxy *proxy = data;
734 Eldbus_Message_Iter *dict; 741 Eldbus_Message_Iter *dict;
735 const char *name, *error_msg; 742 const char *name, *error_msg;
736 Eldbus_Proxy_Event_Property_Loaded event; 743 Eldbus_Proxy_Event_Property_Loaded event;
737 744
745 eldbus_proxy_event_callback_del(proxy, ELDBUS_PROXY_EVENT_DEL,
746 _on_monitored_proxy_del, pending);
747
738 if (eldbus_message_error_get(msg, &name, &error_msg)) 748 if (eldbus_message_error_get(msg, &name, &error_msg))
739 { 749 {
740 ERR("Error getting all properties of %s %s, error message: %s %s", 750 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
760EAPI Eina_Bool 770EAPI Eina_Bool
761eldbus_proxy_properties_monitor(Eldbus_Proxy *proxy, Eina_Bool enable) 771eldbus_proxy_properties_monitor(Eldbus_Proxy *proxy, Eina_Bool enable)
762{ 772{
773 Eldbus_Pending *pending;
763 ELDBUS_PROXY_CHECK_RETVAL(proxy, EINA_FALSE); 774 ELDBUS_PROXY_CHECK_RETVAL(proxy, EINA_FALSE);
764 if (proxy->monitor_enabled == enable) 775 if (proxy->monitor_enabled == enable)
765 return proxy->props ? !!eina_hash_population(proxy->props) : EINA_FALSE; 776 return proxy->props ? !!eina_hash_population(proxy->props) : EINA_FALSE;
@@ -787,7 +798,9 @@ eldbus_proxy_properties_monitor(Eldbus_Proxy *proxy, Eina_Bool enable)
787 if (!proxy->props) 798 if (!proxy->props)
788 proxy->props = eina_hash_string_superfast_new(_props_cache_free); 799 proxy->props = eina_hash_string_superfast_new(_props_cache_free);
789 800
790 eldbus_proxy_property_get_all(proxy, _props_get_all, proxy); 801 pending = eldbus_proxy_property_get_all(proxy, _props_get_all, proxy);
802 eldbus_proxy_event_callback_add(proxy, ELDBUS_PROXY_EVENT_DEL,
803 _on_monitored_proxy_del, pending);
791 804
792 if (proxy->properties_changed) 805 if (proxy->properties_changed)
793 return !!eina_hash_population(proxy->props); 806 return !!eina_hash_population(proxy->props);