commit 6bf8bb9d169e5369743385961a8defabf3f8a763
parent 7b73be58476929b49f3e6859c552d1dc1f33aba1
Author: Jacki <jacki@thejackimonster.de>
Date: Sun, 21 Jul 2024 03:09:30 +0200
Fix hangup via duplicate sync
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat:
20 files changed, 144 insertions(+), 91 deletions(-)
diff --git a/src/application.c b/src/application.c
@@ -26,6 +26,7 @@
#include "request.h"
#include "resources.h"
+#include <glib-2.0/glib.h>
#include <gnunet/gnunet_common.h>
#include <gnunet/gnunet_chat_lib.h>
#include <gstreamer-1.0/gst/gst.h>
@@ -740,6 +741,34 @@ application_call_message_event(MESSENGER_Application *app,
);
}
+void
+application_chat_lock(MESSENGER_Application *app)
+{
+ g_assert(app);
+
+ if (app->ui.schedule.function)
+ {
+ g_assert(!(app->chat.schedule.locked));
+ return;
+ }
+
+ schedule_sync_lock(&(app->chat.schedule));
+}
+
+void
+application_chat_unlock(MESSENGER_Application *app)
+{
+ g_assert(app);
+
+ if (app->ui.schedule.function)
+ {
+ g_assert(!(app->chat.schedule.locked));
+ return;
+ }
+
+ schedule_sync_unlock(&(app->chat.schedule));
+}
+
static gboolean
_application_stop_chat(gpointer user_data)
{
diff --git a/src/application.h b/src/application.h
@@ -282,6 +282,12 @@ application_call_message_event(MESSENGER_Application *app,
struct GNUNET_CHAT_Context *context,
const struct GNUNET_CHAT_Message *message);
+void
+application_chat_lock(MESSENGER_Application *app);
+
+void
+application_chat_unlock(MESSENGER_Application *app);
+
/**
* Signals the second thread to exit the application.
*
diff --git a/src/schedule.c b/src/schedule.c
@@ -184,7 +184,12 @@ schedule_sync_run(MESSENGER_Schedule *schedule,
GSourceFunc function,
gpointer data)
{
- g_assert((schedule) && (function));
+ g_assert(
+ (schedule) &&
+ (!(schedule->locked)) &&
+ (!(schedule->function)) &&
+ (function)
+ );
schedule->function = function;
schedule->data = data;
@@ -200,7 +205,11 @@ schedule_sync_run(MESSENGER_Schedule *schedule,
void
schedule_sync_lock(MESSENGER_Schedule *schedule)
{
- g_assert(schedule);
+ g_assert(
+ (schedule) &&
+ (!(schedule->locked)) &&
+ (!(schedule->function))
+ );
const MESSENGER_ScheduleSignal push = MESSENGER_SCHEDULE_SIGNAL_LOCK;
@@ -211,12 +220,18 @@ schedule_sync_lock(MESSENGER_Schedule *schedule)
pthread_mutex_lock(&(schedule->push_mutex));
pthread_mutex_unlock(&(schedule->push_mutex));
+
+ schedule->locked = TRUE;
}
void
schedule_sync_unlock(MESSENGER_Schedule *schedule)
{
- g_assert(schedule);
+ g_assert(
+ (schedule) &&
+ (schedule->locked) &&
+ (!(schedule->function))
+ );
MESSENGER_ScheduleSignal sync;
@@ -224,4 +239,6 @@ schedule_sync_unlock(MESSENGER_Schedule *schedule)
g_assert(sizeof(sync) == read(schedule->sync_pipe[0], &sync, sizeof(sync)));
g_assert(MESSENGER_SCHEDULE_SIGNAL_LOCK == sync);
+
+ schedule->locked = FALSE;
}
diff --git a/src/schedule.h b/src/schedule.h
@@ -40,6 +40,7 @@ typedef struct MESSENGER_Schedule {
pthread_mutex_t push_mutex;
pthread_mutex_t sync_mutex;
+ gboolean locked;
GSourceFunc function;
gpointer data;
diff --git a/src/ui/accounts.c b/src/ui/accounts.c
@@ -96,9 +96,9 @@ handle_accounts_listbox_row_activated(UNUSED GtkListBox* listbox,
G_SOURCE_FUNC(_show_messenger_main_window), app
);
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
GNUNET_CHAT_connect(app->chat.messenger.handle, account);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
gtk_list_box_unselect_all(app->ui.messenger.accounts_listbox);
gtk_widget_set_sensitive(GTK_WIDGET(app->ui.accounts.dialog), FALSE);
diff --git a/src/ui/chat.c b/src/ui/chat.c
@@ -165,12 +165,12 @@ handle_chat_contacts_listbox_row_activated(GtkListBox *listbox,
hdy_flap_set_reveal_flap(handle->flap_chat_details, FALSE);
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
ui_contact_info_dialog_init(app, &(app->ui.contact_info));
ui_contact_info_dialog_update(&(app->ui.contact_info), contact, FALSE);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
gtk_widget_show(GTK_WIDGET(app->ui.contact_info.dialog));
}
@@ -218,12 +218,12 @@ handle_reveal_identity_button_click(GtkButton *button,
hdy_flap_set_reveal_flap(handle->flap_chat_details, FALSE);
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
ui_contact_info_dialog_init(app, &(app->ui.contact_info));
ui_contact_info_dialog_update(&(app->ui.contact_info), contact, TRUE);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
gtk_widget_show(GTK_WIDGET(app->ui.contact_info.dialog));
}
@@ -260,9 +260,9 @@ handle_block_button_click(UNUSED GtkButton *button,
if (!contact)
return;
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
GNUNET_CHAT_contact_set_blocked(contact, GNUNET_YES);
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
gtk_stack_set_visible_child(handle->block_stack, GTK_WIDGET(handle->unblock_button));
}
@@ -282,9 +282,9 @@ handle_unblock_button_click(UNUSED GtkButton *button,
if (!contact)
return;
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
GNUNET_CHAT_contact_set_blocked(contact, GNUNET_NO);
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
gtk_stack_set_visible_child(handle->block_stack, GTK_WIDGET(handle->block_button));
}
@@ -300,7 +300,7 @@ handle_leave_chat_button_click(UNUSED GtkButton *button,
if ((!handle) || (!(handle->context)))
return;
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_context_get_contact(
handle->context
@@ -315,7 +315,7 @@ handle_leave_chat_button_click(UNUSED GtkButton *button,
else if (group)
GNUNET_CHAT_group_leave(group);
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
UI_CHAT_ENTRY_Handle *entry = GNUNET_CHAT_context_get_user_pointer(
handle->context
@@ -438,7 +438,7 @@ handle_chat_messages_filter(GtkListBoxRow *row,
filterTags.filter = &(filter[1]);
filterTags.matching = FALSE;
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
GNUNET_CHAT_message_iterate_tags(
message->msg,
@@ -446,7 +446,7 @@ handle_chat_messages_filter(GtkListBoxRow *row,
&filterTags
);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
result |= filterTags.matching;
}
@@ -610,9 +610,9 @@ _send_text_from_view(MESSENGER_Application *app,
if (handle->context)
{
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
GNUNET_CHAT_context_send_text(handle->context, text);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
}
g_free(text);
@@ -688,7 +688,7 @@ handle_send_record_button_click(GtkButton *button,
ui_label_set_text(file_load->file_label, handle->recording_filename);
gtk_progress_bar_set_fraction(file_load->load_progress_bar, 0.0);
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
struct GNUNET_CHAT_File *file = GNUNET_CHAT_context_send_file(
handle->context,
@@ -706,7 +706,7 @@ handle_send_record_button_click(GtkButton *button,
else if (file_load)
ui_file_load_entry_delete(file_load);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
_drop_any_recording(handle);
return;
diff --git a/src/ui/chat_title.c b/src/ui/chat_title.c
@@ -131,7 +131,7 @@ _new_tag_callback(MESSENGER_Application *app,
if ((!message) || (!(message->msg)))
goto skip_row;
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
GNUNET_CHAT_context_send_tag(
handle->context,
@@ -139,7 +139,7 @@ _new_tag_callback(MESSENGER_Application *app,
tag
);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
skip_row:
selected = selected->next;
@@ -197,7 +197,7 @@ _delete_messages_callback(MESSENGER_Application *app,
if ((!message) || (!(message->msg)))
goto skip_row;
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
GNUNET_CHAT_message_delete(
message->msg,
@@ -207,7 +207,7 @@ _delete_messages_callback(MESSENGER_Application *app,
)
);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
skip_row:
selected = selected->next;
diff --git a/src/ui/contact_info.c b/src/ui/contact_info.c
@@ -62,7 +62,7 @@ handle_contact_edit_button_click(UNUSED GtkButton *button,
if ((name) && (0 == g_utf8_strlen(name, 1)))
name = NULL;
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
if (change_own_name)
{
@@ -75,7 +75,7 @@ handle_contact_edit_button_click(UNUSED GtkButton *button,
else
GNUNET_CHAT_contact_set_name(handle->contact, name);
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
skip_change_name:
gtk_image_set_from_icon_name(
@@ -192,7 +192,7 @@ handle_profile_chooser_file_set(GtkFileChooserButton *button,
if (!filename)
return;
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
GNUNET_CHAT_upload_file(
handle->app->chat.messenger.handle,
@@ -201,7 +201,7 @@ handle_profile_chooser_file_set(GtkFileChooserButton *button,
handle->app
);
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
g_free(filename);
}
@@ -264,9 +264,9 @@ handle_block_button_click(UNUSED GtkButton *button,
if (!(handle->contact))
return;
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
GNUNET_CHAT_contact_set_blocked(handle->contact, GNUNET_YES);
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
gtk_stack_set_visible_child(
handle->block_stack,
@@ -285,9 +285,9 @@ handle_unblock_button_click(UNUSED GtkButton *button,
if (!(handle->contact))
return;
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
GNUNET_CHAT_contact_set_blocked(handle->contact, GNUNET_NO);
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
gtk_stack_set_visible_child(
handle->block_stack,
@@ -683,9 +683,9 @@ handle_value_renderer_edit(GtkCellRendererText *renderer,
if (!chat)
return;
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
const gboolean owned = (GNUNET_YES == GNUNET_CHAT_contact_is_owned(handle->contact));
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
if ((handle->contact) && (!owned))
return;
@@ -697,17 +697,17 @@ handle_value_renderer_edit(GtkCellRendererText *renderer,
if ((new_text) && (strlen(new_text)))
{
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
GNUNET_CHAT_set_attribute(chat, name, new_text, GNUNET_TIME_relative_get_forever_());
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
gtk_list_store_set(handle->attributes_list, &iter, 1, new_text, -1);
}
else
{
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
GNUNET_CHAT_delete_attribute(chat, name);
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
gtk_list_store_remove(handle->attributes_list, &iter);
}
@@ -747,9 +747,9 @@ handle_add_attribute_button_click(UNUSED GtkButton *button,
if ((name) && (value))
{
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
GNUNET_CHAT_set_attribute(chat, name, value, GNUNET_TIME_relative_get_forever_());
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
gtk_list_store_insert_with_values(
handle->attributes_list,
@@ -796,9 +796,9 @@ handle_share_renderer_toggle(GtkCellRendererToggle *renderer,
if (!chat)
return;
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
const gboolean owned = (GNUNET_YES == GNUNET_CHAT_contact_is_owned(handle->contact));
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
if ((!(handle->contact)) || (owned))
return;
@@ -812,14 +812,14 @@ handle_share_renderer_toggle(GtkCellRendererToggle *renderer,
const gchar *name = g_value_get_string(&value_name);
const gboolean shared = g_value_get_boolean(&value_shared);
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
if (shared)
GNUNET_CHAT_unshare_attribute_from(chat, handle->contact, name);
else
GNUNET_CHAT_share_attribute_with(chat, handle->contact, name);
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
gtk_list_store_set(handle->sharing_list, &iter, 2, !shared, -1);
diff --git a/src/ui/contacts.c b/src/ui/contacts.c
@@ -73,29 +73,29 @@ handle_contacts_listbox_row_activated(UNUSED GtkListBox* listbox,
if (!contact)
goto close_dialog;
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
const gboolean closing = (
(!GNUNET_CHAT_contact_get_key(contact)) ||
(GNUNET_YES == GNUNET_CHAT_contact_is_owned(contact))
);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
if (closing)
goto close_dialog;
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
struct GNUNET_CHAT_Context *context = GNUNET_CHAT_contact_get_context(
contact
);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
if (!context)
goto close_dialog;
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
if (GNUNET_SYSERR == GNUNET_CHAT_context_get_status(context))
GNUNET_CHAT_context_request(context);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
close_dialog:
gtk_window_close(GTK_WINDOW(app->ui.contacts.dialog));
diff --git a/src/ui/discourse.c b/src/ui/discourse.c
@@ -169,13 +169,13 @@ handle_call_start_button_click(UNUSED GtkButton *button,
if (!(handle->context))
return;
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
handle->voice_discourse = GNUNET_CHAT_context_open_discourse(
handle->context, get_voice_discourse_id()
);
_update_call_button(handle);
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
}
static void
@@ -189,12 +189,12 @@ handle_call_stop_button_click(UNUSED GtkButton *button,
if ((!(handle->context)) || (!(handle->voice_discourse)))
return;
- schedule_sync_lock(&(handle->app->chat.schedule));
+ application_chat_lock(handle->app);
GNUNET_CHAT_discourse_close(handle->voice_discourse);
handle->voice_discourse = NULL;
_update_call_button(handle);
- schedule_sync_unlock(&(handle->app->chat.schedule));
+ application_chat_unlock(handle->app);
}
static void
diff --git a/src/ui/files.c b/src/ui/files.c
@@ -70,7 +70,7 @@ handle_files_listbox_row_activated(UNUSED GtkListBox* listbox,
g_object_get_qdata(G_OBJECT(row), app->quarks.data)
);
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
const gdouble progress = (
(gdouble) GNUNET_CHAT_file_get_local_size(file) /
@@ -89,7 +89,7 @@ handle_files_listbox_row_activated(UNUSED GtkListBox* listbox,
GNUNET_YES != GNUNET_CHAT_file_is_ready(file)
);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
UI_FILE_ENTRY_Handle *entry = (UI_FILE_ENTRY_Handle*) (
g_object_get_qdata(G_OBJECT(row), app->quarks.ui)
diff --git a/src/ui/invite_contact.c b/src/ui/invite_contact.c
@@ -55,7 +55,7 @@ handle_contacts_listbox_row_activated(GtkListBox* listbox,
g_object_get_qdata(G_OBJECT(row), app->quarks.data)
);
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
if ((!contact) || (!GNUNET_CHAT_contact_get_key(contact)) ||
(GNUNET_YES == GNUNET_CHAT_contact_is_owned(contact)) ||
@@ -77,7 +77,7 @@ handle_contacts_listbox_row_activated(GtkListBox* listbox,
GNUNET_CHAT_group_invite_contact(group, contact);
close_dialog:
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
gtk_window_close(GTK_WINDOW(app->ui.invite_contact.dialog));
}
diff --git a/src/ui/message.c b/src/ui/message.c
@@ -72,25 +72,25 @@ handle_file_button_click(GtkButton *button,
if (!file)
return;
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
uint64_t size = GNUNET_CHAT_file_get_size(file);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
if (size <= 0)
return;
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
uint64_t local_size = GNUNET_CHAT_file_get_local_size(file);
const gboolean downloading = (GNUNET_YES == GNUNET_CHAT_file_is_downloading(file));
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
if (downloading)
{
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
GNUNET_CHAT_file_stop_download(file);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
gtk_image_set_from_icon_name(
handle->file_status_image,
@@ -100,13 +100,13 @@ handle_file_button_click(GtkButton *button,
}
else if (local_size < size)
{
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
GNUNET_CHAT_file_start_download(
file,
handle_downloading_file,
app
);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
gtk_image_set_from_icon_name(
handle->file_status_image,
@@ -116,9 +116,9 @@ handle_file_button_click(GtkButton *button,
}
else if (size > 0)
{
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
const gchar *preview = GNUNET_CHAT_file_open_preview(file);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
if (!preview)
return;
@@ -128,9 +128,9 @@ handle_file_button_click(GtkButton *button,
if (!g_app_info_launch_default_for_uri(uri->str, NULL, NULL))
{
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
GNUNET_CHAT_file_close_preview(file);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
}
g_string_free(uri, TRUE);
@@ -159,9 +159,9 @@ handle_media_button_click(GtkButton *button,
if (!file)
return;
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
const gchar *preview = GNUNET_CHAT_file_open_preview(file);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
if (!preview)
return;
diff --git a/src/ui/messenger.c b/src/ui/messenger.c
@@ -212,13 +212,13 @@ handle_accounts_listbox_row_activated(UNUSED GtkListBox* listbox,
if (!account)
return;
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
const struct GNUNET_CHAT_Account *current = GNUNET_CHAT_get_connected(
app->chat.messenger.handle
);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
if (account == current)
return;
@@ -226,9 +226,9 @@ handle_accounts_listbox_row_activated(UNUSED GtkListBox* listbox,
_switch_details_revealer_visibility(&(app->ui.messenger), FALSE);
hdy_flap_set_reveal_flap(HDY_FLAP(app->ui.messenger.flap_user_details), FALSE);
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
GNUNET_CHAT_connect(app->chat.messenger.handle, account);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
}
static void
diff --git a/src/ui/new_account.c b/src/ui/new_account.c
@@ -37,13 +37,13 @@ _open_new_account(GtkEntry *entry,
const gchar *name = gtk_entry_get_text(entry);
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
const enum GNUNET_GenericReturnValue result = GNUNET_CHAT_account_create(
app->chat.messenger.handle, name
);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
if (GNUNET_OK != result)
return;
diff --git a/src/ui/new_contact.c b/src/ui/new_contact.c
@@ -66,9 +66,9 @@ handle_confirm_button_click(UNUSED GtkButton *button,
if (!uri)
goto close_dialog;
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
GNUNET_CHAT_lobby_join(app->chat.messenger.handle, uri);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
GNUNET_CHAT_uri_destroy(uri);
diff --git a/src/ui/new_group.c b/src/ui/new_group.c
@@ -37,7 +37,7 @@ _open_new_group(GtkEntry *entry,
const gchar *name = gtk_entry_get_text(entry);
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
struct GNUNET_CHAT_Group *group = GNUNET_CHAT_group_create(
app->chat.messenger.handle,
@@ -47,7 +47,7 @@ _open_new_group(GtkEntry *entry,
if ((name) && (strlen(name) > 0))
GNUNET_CHAT_group_set_name(group, name);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
GList *selected = gtk_list_box_get_selected_rows(listbox);
@@ -62,9 +62,9 @@ _open_new_group(GtkEntry *entry,
g_object_get_qdata(G_OBJECT(row), app->quarks.data)
);
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
GNUNET_CHAT_group_invite_contact(group, contact);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
}
item = item->next;
diff --git a/src/ui/new_platform.c b/src/ui/new_platform.c
@@ -37,7 +37,7 @@ _open_new_platform(GtkEntry *entry,
GString *topic_string = g_string_new(topic);
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
struct GNUNET_CHAT_Group *group = GNUNET_CHAT_group_create(
app->chat.messenger.handle,
@@ -47,7 +47,7 @@ _open_new_platform(GtkEntry *entry,
g_string_prepend_c(topic_string, '#');
GNUNET_CHAT_group_set_name(group, topic_string->str);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
g_string_free(topic_string, TRUE);
}
diff --git a/src/ui/send_file.c b/src/ui/send_file.c
@@ -102,7 +102,7 @@ handle_send_button_click(GtkButton *button,
gtk_label_set_text(file_load->file_label, filename);
gtk_progress_bar_set_fraction(file_load->load_progress_bar, 0.0);
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
file = GNUNET_CHAT_context_send_file(
context,
@@ -111,7 +111,7 @@ handle_send_button_click(GtkButton *button,
file_load
);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
}
g_free(filename);
diff --git a/src/ui/settings.c b/src/ui/settings.c
@@ -161,7 +161,7 @@ handle_leave_chats_button_click(UNUSED GtkButton* button,
MESSENGER_Application *app = (MESSENGER_Application*) user_data;
- schedule_sync_lock(&(app->chat.schedule));
+ application_chat_lock(app);
GNUNET_CHAT_iterate_groups(
app->chat.messenger.handle,
@@ -175,7 +175,7 @@ handle_leave_chats_button_click(UNUSED GtkButton* button,
NULL
);
- schedule_sync_unlock(&(app->chat.schedule));
+ application_chat_unlock(app);
}
static void