diff options
Diffstat (limited to 'src/application.c')
-rw-r--r-- | src/application.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/application.c b/src/application.c index 2062b82..24b6490 100644 --- a/src/application.c +++ b/src/application.c | |||
@@ -77,6 +77,8 @@ application_init(MESSENGER_Application *app, | |||
77 | app->chat.tid = 0; | 77 | app->chat.tid = 0; |
78 | app->chat.signal = MESSENGER_NONE; | 78 | app->chat.signal = MESSENGER_NONE; |
79 | 79 | ||
80 | pthread_mutex_init(&(app->chat.mutex), NULL); | ||
81 | |||
80 | app->ui.mobile = FALSE; | 82 | app->ui.mobile = FALSE; |
81 | 83 | ||
82 | app->ui.bindings = g_hash_table_new(g_direct_hash, g_direct_equal); | 84 | app->ui.bindings = g_hash_table_new(g_direct_hash, g_direct_equal); |
@@ -159,6 +161,8 @@ application_run(MESSENGER_Application *app) | |||
159 | 161 | ||
160 | g_hash_table_destroy(app->ui.bindings); | 162 | g_hash_table_destroy(app->ui.bindings); |
161 | 163 | ||
164 | pthread_mutex_destroy(&(app->chat.mutex)); | ||
165 | |||
162 | notify_uninit(); | 166 | notify_uninit(); |
163 | 167 | ||
164 | g_object_unref(app->application); | 168 | g_object_unref(app->application); |
@@ -213,7 +217,10 @@ _application_message_event_call(gpointer user_data) | |||
213 | MESSENGER_ApplicationMessageEventCall *call; | 217 | MESSENGER_ApplicationMessageEventCall *call; |
214 | 218 | ||
215 | call = (MESSENGER_ApplicationMessageEventCall*) user_data; | 219 | call = (MESSENGER_ApplicationMessageEventCall*) user_data; |
220 | |||
221 | pthread_mutex_lock(&(call->app->chat.mutex)); | ||
216 | call->event(call->app, call->context, call->message); | 222 | call->event(call->app, call->context, call->message); |
223 | pthread_mutex_unlock(&(call->app->chat.mutex)); | ||
217 | 224 | ||
218 | GNUNET_free(call); | 225 | GNUNET_free(call); |
219 | return FALSE; | 226 | return FALSE; |
@@ -227,6 +234,9 @@ application_call_message_event(MESSENGER_Application *app, | |||
227 | { | 234 | { |
228 | MESSENGER_ApplicationMessageEventCall *call; | 235 | MESSENGER_ApplicationMessageEventCall *call; |
229 | 236 | ||
237 | if (!event) | ||
238 | return; | ||
239 | |||
230 | call = (MESSENGER_ApplicationMessageEventCall*) GNUNET_malloc( | 240 | call = (MESSENGER_ApplicationMessageEventCall*) GNUNET_malloc( |
231 | sizeof(MESSENGER_ApplicationMessageEventCall) | 241 | sizeof(MESSENGER_ApplicationMessageEventCall) |
232 | ); | 242 | ); |