comparison libpurple/protocols/msn/transaction.c @ 28353:6a23d7f84143

Allow setting a destroy-function for the data. Fixes a leak.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 09 Oct 2009 18:01:51 +0000
parents 273efe387134
children 54c8aeecab4c
comparison
equal deleted inserted replaced
28352:3061a0c72b26 28353:6a23d7f84143
57 57
58 g_free(trans->command); 58 g_free(trans->command);
59 g_free(trans->params); 59 g_free(trans->params);
60 g_free(trans->payload); 60 g_free(trans->payload);
61 61
62 if (trans->data_free)
63 trans->data_free(trans->data);
64
62 #if 0 65 #if 0
63 if (trans->pendent_cmd != NULL) 66 if (trans->pendent_cmd != NULL)
64 msn_message_unref(trans->pendent_msg); 67 msn_message_unref(trans->pendent_msg);
65 #endif 68 #endif
66 69
163 g_return_if_fail(trans != NULL); 166 g_return_if_fail(trans != NULL);
164 167
165 trans->data = data; 168 trans->data = data;
166 } 169 }
167 170
171 void msn_transaction_set_data_free(MsnTransaction *trans, GDestroyNotify fn)
172 {
173 g_return_if_fail(trans != NULL);
174 trans->data_free = fn;
175 }
176
168 void 177 void
169 msn_transaction_add_cb(MsnTransaction *trans, char *answer, 178 msn_transaction_add_cb(MsnTransaction *trans, char *answer,
170 MsnTransCb cb) 179 MsnTransCb cb)
171 { 180 {
172 g_return_if_fail(trans != NULL); 181 g_return_if_fail(trans != NULL);