[Telepathy-commits] [telepathy-mission-control/master] Don't access fields of a possibly deleted struct.

Alberto Mardegan alberto.mardegan at nokia.com
Wed Feb 11 01:25:34 PST 2009


Do not rely on the "req" structure in being there anymore. It could have been
destroyed in the callback.
---
 libmcclient/mc-account-request.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libmcclient/mc-account-request.c b/libmcclient/mc-account-request.c
index a41ff2f..3a3cdd2 100644
--- a/libmcclient/mc-account-request.c
+++ b/libmcclient/mc-account-request.c
@@ -92,15 +92,19 @@ mc_request_free (McChannelRequest *req)
 static void
 emit_request_event (McChannelRequest *req, McAccountChannelrequestEvent event)
 {
+    guint id;
+
+    id = REQUEST_ID (req);
+
     if (req->callback)
-        req->callback (req->account, REQUEST_ID (req), event,
+        req->callback (req->account, id, event,
                        req->user_data, req->weak_object);
 
     if (event == MC_ACCOUNT_CR_SUCCEEDED ||
         event == MC_ACCOUNT_CR_FAILED ||
         event == MC_ACCOUNT_CR_CANCELLED)
     {
-        g_hash_table_remove (requests, GUINT_TO_POINTER (REQUEST_ID (req)));
+        g_hash_table_remove (requests, GUINT_TO_POINTER (id));
     }
 }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list