Skip to content
Snippets Groups Projects
Commit 26f3f2c2 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3218] Free memory when ending call in gnome client

parent 47033d60
No related branches found
No related tags found
No related merge requests found
...@@ -185,6 +185,7 @@ sflphone_hung_up( callable_obj_t * c) ...@@ -185,6 +185,7 @@ sflphone_hung_up( callable_obj_t * c)
calltree_remove_call(current_calls, c, NULL); calltree_remove_call(current_calls, c, NULL);
c->_state = CALL_STATE_DIALING; c->_state = CALL_STATE_DIALING;
call_remove_all_errors(c); call_remove_all_errors(c);
free_callable_obj_t(c);
update_actions(); update_actions();
#if GTK_CHECK_VERSION(2,10,0) #if GTK_CHECK_VERSION(2,10,0)
status_tray_icon_blink( FALSE ); status_tray_icon_blink( FALSE );
......
...@@ -129,6 +129,19 @@ void call_remove_all_errors(callable_obj_t * call) ...@@ -129,6 +129,19 @@ void call_remove_all_errors(callable_obj_t * call)
g_ptr_array_foreach (call->_error_dialogs, (GFunc) gtk_widget_destroy, NULL); g_ptr_array_foreach (call->_error_dialogs, (GFunc) gtk_widget_destroy, NULL);
} }
void *threaded_clock_incrementer(void *pc) {
int count = 0;
callable_obj_t *call = (callable_obj_t *)pc;
while(call->clockStarted) {
DEBUG("Clock started: %d", call->clockStarted);
DEBUG("Clock: %d\n", count++);
sleep(1);
}
}
void create_new_call (callable_type_t type, call_state_t state, gchar* callID , gchar* accountID, gchar* peer_name, gchar* peer_number, callable_obj_t ** new_call) void create_new_call (callable_type_t type, call_state_t state, gchar* callID , gchar* accountID, gchar* peer_name, gchar* peer_number, callable_obj_t ** new_call)
{ {
...@@ -162,6 +175,10 @@ void create_new_call (callable_type_t type, call_state_t state, gchar* callID , ...@@ -162,6 +175,10 @@ void create_new_call (callable_type_t type, call_state_t state, gchar* callID ,
obj->_callID = g_strdup (call_id); obj->_callID = g_strdup (call_id);
obj->_confID = NULL; obj->_confID = NULL;
obj->clockStarted = 1;
pthread_create(&(obj->tid), NULL, threaded_clock_incrementer, obj);
*new_call = obj; *new_call = obj;
} }
...@@ -255,6 +272,10 @@ void create_history_entry_from_serialized_form (gchar *timestamp, gchar *details ...@@ -255,6 +272,10 @@ void create_history_entry_from_serialized_form (gchar *timestamp, gchar *details
void free_callable_obj_t (callable_obj_t *c) void free_callable_obj_t (callable_obj_t *c)
{ {
c->clockStarted = 0;
pthread_join(c->tid, NULL);
g_free (c->_callID); g_free (c->_callID);
g_free (c->_accountID); g_free (c->_accountID);
g_free (c->_peer_name); g_free (c->_peer_name);
......
...@@ -154,6 +154,8 @@ typedef struct { ...@@ -154,6 +154,8 @@ typedef struct {
// thread id to increment clock // thread id to increment clock
pthread_t tid; pthread_t tid;
int clockStarted;
} callable_obj_t; } callable_obj_t;
void create_new_call (callable_type_t, call_state_t, gchar*, gchar*, gchar*, gchar*, callable_obj_t **); void create_new_call (callable_type_t, call_state_t, gchar*, gchar*, gchar*, gchar*, callable_obj_t **);
......
...@@ -74,17 +74,6 @@ enum { ...@@ -74,17 +74,6 @@ enum {
COLUMN_ACCOUNT_PTR, COLUMN_ACCOUNT_PTR,
}; };
void *threaded_clock_incrementer(void *call) {
int count = 0;
while(1) {
printf("Clock: %d\n", count++);
sleep(1);
}
}
/** /**
* Show popup menu * Show popup menu
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment