summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Roberto de Souza <jose.souza@intel.com>2013-11-29 17:21:14 -0200
committerdiscomfitor <michael.blumenkrantz@gmail.com>2013-12-14 19:52:03 -0500
commit880aa578c9c280101980c985e640882b57d9d272 (patch)
tree37326184f836ed229035b9fa5127676aaac3a877
parent5c96239cb5acafd2b11c07d5ec7ad3f2f3618543 (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_proxy.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lib/eldbus_proxy.c b/src/lib/eldbus_proxy.c
index 9f02751..fcd553a 100644
--- a/src/lib/eldbus_proxy.c
+++ b/src/lib/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);