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

[#3853] Stop callableobj thread outside free_callable_obj_t

parent b1c4a813
Branches
Tags
No related merge requests found
...@@ -410,6 +410,8 @@ sflphone_hang_up() ...@@ -410,6 +410,8 @@ sflphone_hang_up()
calltree_update_call (history, selectedCall, NULL); calltree_update_call (history, selectedCall, NULL);
stop_call_clock (selectedCall);
calltree_update_clock(); calltree_update_clock();
} }
......
...@@ -136,6 +136,8 @@ void threaded_clock_incrementer (void *pc) ...@@ -136,6 +136,8 @@ void threaded_clock_incrementer (void *pc)
while (call->clockStarted) { while (call->clockStarted) {
DEBUG ("CALL CLOCK");
int duration; int duration;
time_t start, current; time_t start, current;
...@@ -184,6 +186,27 @@ void threaded_clock_incrementer (void *pc) ...@@ -184,6 +186,27 @@ void threaded_clock_incrementer (void *pc)
} }
DEBUG ("CallableObj: Stopping Thread");
g_thread_exit (NULL);
}
void stop_call_clock (callable_obj_t *c)
{
DEBUG ("CallableObj: Stop call clock");
if (!c) {
ERROR ("CallableObj: Callable object is NULL");
return;
}
if (c->_type == CALL && c->clockStarted) {
c->clockStarted = 0;
/// no need to join here, only need to call g_thread_exit at the end of the threaded function
// g_thread_join (c->tid);
}
} }
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)
...@@ -332,14 +355,7 @@ void free_callable_obj_t (callable_obj_t *c) ...@@ -332,14 +355,7 @@ void free_callable_obj_t (callable_obj_t *c)
{ {
DEBUG ("CallableObj: Free callable object"); DEBUG ("CallableObj: Free callable object");
if (!c) stop_call_clock (c);
ERROR ("CallableObj: Callable object is NULL");
if (c->_type == CALL) {
c->clockStarted = 0;
g_thread_join (c->tid);
}
g_free (c->_callID); g_free (c->_callID);
g_free (c->_accountID); g_free (c->_accountID);
......
...@@ -200,6 +200,9 @@ attach_thumbnail (callable_obj_t *, GdkPixbuf *); ...@@ -200,6 +200,9 @@ attach_thumbnail (callable_obj_t *, GdkPixbuf *);
void void
free_callable_obj_t (callable_obj_t *c); free_callable_obj_t (callable_obj_t *c);
void
stop_call_clock (callable_obj_t *c);
/** /**
* @return gchar* A random ID * @return gchar* A random ID
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment