aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-05-31 21:05:43 +0000
committerChristian Grothoff <christian@grothoff.org>2014-05-31 21:05:43 +0000
commit4b9a196cab0efd4767c165bfef339b24b8688741 (patch)
treec9858df8eb9f1b6cc74bedd86258dd5cd4886cf8
parent338e527f87b490f94a30fcdf5fb5f714da6c48a5 (diff)
downloadgnunet-gtk-4b9a196cab0efd4767c165bfef339b24b8688741.tar.gz
gnunet-gtk-4b9a196cab0efd4767c165bfef339b24b8688741.zip
expand clean-up logic
-rw-r--r--src/conversation/gnunet-conversation-gtk_phone.c46
1 files changed, 41 insertions, 5 deletions
diff --git a/src/conversation/gnunet-conversation-gtk_phone.c b/src/conversation/gnunet-conversation-gtk_phone.c
index bbd1cb53..7a08d87f 100644
--- a/src/conversation/gnunet-conversation-gtk_phone.c
+++ b/src/conversation/gnunet-conversation-gtk_phone.c
@@ -352,6 +352,44 @@ static GtkEntry *address_entry;
352 352
353 353
354/** 354/**
355 * Free data structure associated with an incoming call.
356 *
357 * @param ic incoming call to free
358 */
359static void
360destroy_in (struct IncomingCall *ic)
361{
362 if (NULL != ic->caller)
363 {
364 GNUNET_CONVERSATION_caller_hang_up (ic->caller);
365 ic->caller = NULL;
366 }
367 GNUNET_free (ic->caller_id);
368 gtk_tree_row_reference_free (ic->rr);
369 GNUNET_free (ic);
370}
371
372
373/**
374 * Free data structure associated with an outgoing call.
375 *
376 * @param oc outgoing call to free
377 */
378static void
379destroy_out (struct OutgoingCall *oc)
380{
381 if (NULL != oc->call)
382 {
383 GNUNET_CONVERSATION_call_stop (oc->call);
384 ic->caller = NULL;
385 }
386 GNUNET_free (oc->peer_name);
387 gtk_tree_row_reference_free (oc->rr);
388 GNUNET_free (oc);
389}
390
391
392/**
355 * Update status based on current phone state. 393 * Update status based on current phone state.
356 * 394 *
357 * @param args arguments given to the command 395 * @param args arguments given to the command
@@ -1165,22 +1203,20 @@ GCG_PHONE_shutdown ()
1165{ 1203{
1166 if (NULL != active_in) 1204 if (NULL != active_in)
1167 { 1205 {
1168 GNUNET_CONVERSATION_caller_hang_up (active_in->caller); 1206 destroy_in (active_in);
1169 // FIXME: memory leak
1170 active_in = NULL; 1207 active_in = NULL;
1171 } 1208 }
1172 if (NULL != active_out) 1209 if (NULL != active_out)
1173 { 1210 {
1174 GNUNET_CONVERSATION_call_stop (active_out->call); 1211 destroy_out (active_out);
1175 // FIXME: memory leak
1176 active_out = NULL; 1212 active_out = NULL;
1177 } 1213 }
1178 // FIXME: clean up tree view!
1179 if (NULL != phone) 1214 if (NULL != phone)
1180 { 1215 {
1181 GNUNET_CONVERSATION_phone_destroy (phone); 1216 GNUNET_CONVERSATION_phone_destroy (phone);
1182 phone = NULL; 1217 phone = NULL;
1183 } 1218 }
1219 gtk_list_store_clear (active_liststore);
1184 GNUNET_SPEAKER_destroy (speaker); 1220 GNUNET_SPEAKER_destroy (speaker);
1185 speaker = NULL; 1221 speaker = NULL;
1186 GNUNET_MICROPHONE_destroy (mic); 1222 GNUNET_MICROPHONE_destroy (mic);