diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2022-03-13 13:56:02 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-03-13 13:56:02 +0100 |
commit | 43019c37a2a12147c401d75327e19e2ac383d6f4 (patch) | |
tree | 50c569d564b9c75559e1d7165f973ae956da04a1 | |
parent | 85b243c149d96ac88c5afd20993bbe18c50e16ca (diff) | |
download | messenger-gtk-43019c37a2a12147c401d75327e19e2ac383d6f4.tar.gz messenger-gtk-43019c37a2a12147c401d75327e19e2ac383d6f4.zip |
Added warning handling and leave messages, cleaning some code and fixed issue with QR pixel data
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | src/chat/messenger.c | 28 | ||||
-rw-r--r-- | src/event.c | 120 | ||||
-rw-r--r-- | src/event.h | 13 | ||||
-rw-r--r-- | src/ui/accounts.c | 10 | ||||
-rw-r--r-- | src/ui/contacts.c | 2 | ||||
-rw-r--r-- | src/ui/delete_messages.c | 2 | ||||
-rw-r--r-- | src/ui/invite_contact.c | 2 | ||||
-rw-r--r-- | src/ui/messenger.c | 1 | ||||
-rw-r--r-- | src/ui/new_account.c | 2 | ||||
-rw-r--r-- | src/ui/new_contact.c | 6 | ||||
-rw-r--r-- | src/ui/new_group.c | 2 | ||||
-rw-r--r-- | src/ui/new_lobby.c | 6 | ||||
-rw-r--r-- | src/ui/new_platform.c | 2 | ||||
-rw-r--r-- | src/ui/send_file.c | 2 | ||||
-rw-r--r-- | src/ui/settings.c | 4 |
15 files changed, 144 insertions, 58 deletions
diff --git a/src/chat/messenger.c b/src/chat/messenger.c index 452e476..6a3f0b9 100644 --- a/src/chat/messenger.c +++ b/src/chat/messenger.c | |||
@@ -101,6 +101,14 @@ _chat_messenger_message(void *cls, | |||
101 | 101 | ||
102 | switch (kind) | 102 | switch (kind) |
103 | { | 103 | { |
104 | case GNUNET_CHAT_KIND_WARNING: | ||
105 | application_call_message_event( | ||
106 | app, | ||
107 | event_handle_warning, | ||
108 | context, | ||
109 | message | ||
110 | ); | ||
111 | break; | ||
104 | case GNUNET_CHAT_KIND_REFRESH: | 112 | case GNUNET_CHAT_KIND_REFRESH: |
105 | { | 113 | { |
106 | application_call_event(app, event_refresh_accounts); | 114 | application_call_event(app, event_refresh_accounts); |
@@ -122,23 +130,19 @@ _chat_messenger_message(void *cls, | |||
122 | break; | 130 | break; |
123 | } | 131 | } |
124 | case GNUNET_CHAT_KIND_JOIN: | 132 | case GNUNET_CHAT_KIND_JOIN: |
133 | case GNUNET_CHAT_KIND_LEAVE: | ||
125 | { | 134 | { |
126 | application_call_message_event( | 135 | application_call_message_event( |
127 | app, | 136 | app, |
128 | (GNUNET_YES == GNUNET_CHAT_message_is_sent(message)? | 137 | (GNUNET_YES == GNUNET_CHAT_message_is_sent(message)? |
129 | event_update_chats : | 138 | event_update_chats : |
130 | event_joining_contact | 139 | event_presence_contact |
131 | ), | 140 | ), |
132 | context, | 141 | context, |
133 | message | 142 | message |
134 | ); | 143 | ); |
135 | break; | 144 | break; |
136 | } | 145 | } |
137 | case GNUNET_CHAT_KIND_LEAVE: | ||
138 | { | ||
139 | // TODO: add status message | ||
140 | break; | ||
141 | } | ||
142 | case GNUNET_CHAT_KIND_CONTACT: | 146 | case GNUNET_CHAT_KIND_CONTACT: |
143 | { | 147 | { |
144 | application_call_message_event( | 148 | application_call_message_event( |
diff --git a/src/event.c b/src/event.c index c4f3a19..544bf43 100644 --- a/src/event.c +++ b/src/event.c | |||
@@ -51,7 +51,8 @@ _show_notification(MESSENGER_Application *app, | |||
51 | UNUSED struct GNUNET_CHAT_Context *context, | 51 | UNUSED struct GNUNET_CHAT_Context *context, |
52 | const struct GNUNET_CHAT_Contact *contact, | 52 | const struct GNUNET_CHAT_Contact *contact, |
53 | const gchar *text, | 53 | const gchar *text, |
54 | const gchar *icon) | 54 | const gchar *icon, |
55 | const gchar *category) | ||
55 | { | 56 | { |
56 | if (app->settings.disable_notifications) | 57 | if (app->settings.disable_notifications) |
57 | return; | 58 | return; |
@@ -67,10 +68,7 @@ _show_notification(MESSENGER_Application *app, | |||
67 | 68 | ||
68 | app->notifications = g_list_append(app->notifications, notification); | 69 | app->notifications = g_list_append(app->notifications, notification); |
69 | 70 | ||
70 | if (0 == g_strcmp0(icon, "avatar-default-symbolic")) | 71 | notify_notification_set_category(notification, category); |
71 | notify_notification_set_category(notification, "presence.online"); | ||
72 | else | ||
73 | notify_notification_set_category(notification, "im.received"); | ||
74 | 72 | ||
75 | g_signal_connect( | 73 | g_signal_connect( |
76 | notification, | 74 | notification, |
@@ -82,15 +80,25 @@ _show_notification(MESSENGER_Application *app, | |||
82 | notify_notification_show(notification, NULL); | 80 | notify_notification_show(notification, NULL); |
83 | } | 81 | } |
84 | 82 | ||
85 | static void | 83 | void |
86 | _clear_each_selectable_widget(GtkWidget *widget, | 84 | event_handle_warning(MESSENGER_Application *app, |
87 | gpointer user_data) | 85 | struct GNUNET_CHAT_Context *context, |
86 | const struct GNUNET_CHAT_Message *msg) | ||
88 | { | 87 | { |
89 | GtkContainer *container = GTK_CONTAINER(user_data); | 88 | const gchar *text = GNUNET_CHAT_message_get_text(msg); |
90 | GtkListBoxRow *row = GTK_LIST_BOX_ROW(widget); | ||
91 | 89 | ||
92 | if (gtk_list_box_row_get_selectable(row)) | 90 | const struct GNUNET_CHAT_Contact *contact = GNUNET_CHAT_message_get_sender( |
93 | gtk_container_remove(container, widget); | 91 | msg |
92 | ); | ||
93 | |||
94 | _show_notification( | ||
95 | app, | ||
96 | context, | ||
97 | contact, | ||
98 | text, | ||
99 | "dialog-warning-symbolic", | ||
100 | "im.error" | ||
101 | ); | ||
94 | } | 102 | } |
95 | 103 | ||
96 | void | 104 | void |
@@ -177,6 +185,48 @@ _iterate_profile_groups(void *cls, | |||
177 | return GNUNET_YES; | 185 | return GNUNET_YES; |
178 | } | 186 | } |
179 | 187 | ||
188 | static void | ||
189 | _clear_chat_entry(GtkWidget *widget, | ||
190 | gpointer user_data) | ||
191 | { | ||
192 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; | ||
193 | |||
194 | UI_MESSENGER_Handle *ui = &(app->ui.messenger); | ||
195 | GtkListBoxRow *row = GTK_LIST_BOX_ROW(widget); | ||
196 | |||
197 | if (!gtk_list_box_row_get_selectable(row)) | ||
198 | return; | ||
199 | |||
200 | UI_CHAT_ENTRY_Handle *entry = (UI_CHAT_ENTRY_Handle*) g_object_get_qdata( | ||
201 | G_OBJECT(row), | ||
202 | app->quarks.ui | ||
203 | ); | ||
204 | |||
205 | ui->chat_entries = g_list_remove(ui->chat_entries, entry); | ||
206 | |||
207 | gtk_container_remove( | ||
208 | GTK_CONTAINER(ui->chats_listbox), | ||
209 | widget | ||
210 | ); | ||
211 | |||
212 | struct GNUNET_CHAT_Context *context = (struct GNUNET_CHAT_Context*) ( | ||
213 | g_object_get_qdata( | ||
214 | G_OBJECT(entry->chat->send_text_view), | ||
215 | app->quarks.data | ||
216 | ) | ||
217 | ); | ||
218 | |||
219 | if (context) | ||
220 | GNUNET_CHAT_context_set_user_pointer(context, NULL); | ||
221 | |||
222 | gtk_container_remove( | ||
223 | GTK_CONTAINER(ui->chats_stack), | ||
224 | entry->chat->chat_box | ||
225 | ); | ||
226 | |||
227 | ui_chat_entry_delete(entry); | ||
228 | } | ||
229 | |||
180 | void | 230 | void |
181 | event_update_profile(MESSENGER_Application *app) | 231 | event_update_profile(MESSENGER_Application *app) |
182 | { | 232 | { |
@@ -198,8 +248,8 @@ event_update_profile(MESSENGER_Application *app) | |||
198 | 248 | ||
199 | gtk_container_foreach( | 249 | gtk_container_foreach( |
200 | GTK_CONTAINER(ui->chats_listbox), | 250 | GTK_CONTAINER(ui->chats_listbox), |
201 | _clear_each_selectable_widget, | 251 | _clear_chat_entry, |
202 | ui->chats_listbox | 252 | app |
203 | ); | 253 | ); |
204 | 254 | ||
205 | gtk_stack_set_visible_child(ui->chats_stack, ui->no_chat_box); | 255 | gtk_stack_set_visible_child(ui->chats_stack, ui->no_chat_box); |
@@ -215,10 +265,17 @@ event_update_chats(MESSENGER_Application *app, | |||
215 | { | 265 | { |
216 | UI_CHAT_ENTRY_Handle *handle = GNUNET_CHAT_context_get_user_pointer(context); | 266 | UI_CHAT_ENTRY_Handle *handle = GNUNET_CHAT_context_get_user_pointer(context); |
217 | 267 | ||
218 | if (!handle) | 268 | const enum GNUNET_CHAT_MessageKind kind = GNUNET_CHAT_message_get_kind( |
219 | _add_new_chat_entry(app, context); | 269 | msg |
220 | else | 270 | ); |
221 | ui_chat_entry_update(handle, app, context); | 271 | |
272 | if (GNUNET_CHAT_KIND_JOIN == kind) | ||
273 | if (!handle) | ||
274 | _add_new_chat_entry(app, context); | ||
275 | else | ||
276 | ui_chat_entry_update(handle, app, context); | ||
277 | else if (handle) | ||
278 | _clear_chat_entry(gtk_widget_get_parent(handle->entry_box), app); | ||
222 | 279 | ||
223 | contact_create_info(GNUNET_CHAT_message_get_sender(msg)); | 280 | contact_create_info(GNUNET_CHAT_message_get_sender(msg)); |
224 | } | 281 | } |
@@ -243,9 +300,9 @@ _update_contact_context(MESSENGER_Application *app, | |||
243 | } | 300 | } |
244 | 301 | ||
245 | void | 302 | void |
246 | event_joining_contact(MESSENGER_Application *app, | 303 | event_presence_contact(MESSENGER_Application *app, |
247 | struct GNUNET_CHAT_Context *context, | 304 | struct GNUNET_CHAT_Context *context, |
248 | const struct GNUNET_CHAT_Message *msg) | 305 | const struct GNUNET_CHAT_Message *msg) |
249 | { | 306 | { |
250 | UI_CHAT_ENTRY_Handle *handle = GNUNET_CHAT_context_get_user_pointer(context); | 307 | UI_CHAT_ENTRY_Handle *handle = GNUNET_CHAT_context_get_user_pointer(context); |
251 | 308 | ||
@@ -259,6 +316,10 @@ event_joining_contact(MESSENGER_Application *app, | |||
259 | if (!contact) | 316 | if (!contact) |
260 | return; | 317 | return; |
261 | 318 | ||
319 | const enum GNUNET_CHAT_MessageKind kind = GNUNET_CHAT_message_get_kind( | ||
320 | msg | ||
321 | ); | ||
322 | |||
262 | UI_MESSAGE_Handle *message = (UI_MESSAGE_Handle*) ( | 323 | UI_MESSAGE_Handle *message = (UI_MESSAGE_Handle*) ( |
263 | GNUNET_CHAT_member_get_user_pointer(context, contact) | 324 | GNUNET_CHAT_member_get_user_pointer(context, contact) |
264 | ); | 325 | ); |
@@ -275,15 +336,18 @@ event_joining_contact(MESSENGER_Application *app, | |||
275 | contact_add_name_avatar_to_info(contact, message->sender_avatar); | 336 | contact_add_name_avatar_to_info(contact, message->sender_avatar); |
276 | contact_add_name_label_to_info(contact, message->sender_label); | 337 | contact_add_name_label_to_info(contact, message->sender_label); |
277 | 338 | ||
278 | const gchar *join_message = _("joined the chat"); | 339 | const gchar *presence_message = ( |
340 | GNUNET_CHAT_KIND_JOIN == kind? _("joined the chat") : _("left the chat") | ||
341 | ); | ||
279 | 342 | ||
280 | if (!ui_messenger_is_context_active(&(app->ui.messenger), context)) | 343 | if (!ui_messenger_is_context_active(&(app->ui.messenger), context)) |
281 | _show_notification( | 344 | _show_notification( |
282 | app, | 345 | app, |
283 | context, | 346 | context, |
284 | contact, | 347 | contact, |
285 | join_message, | 348 | presence_message, |
286 | "avatar-default-symbolic" | 349 | "avatar-default-symbolic", |
350 | "presence.online" | ||
287 | ); | 351 | ); |
288 | 352 | ||
289 | struct GNUNET_TIME_Absolute timestamp = GNUNET_CHAT_message_get_timestamp( | 353 | struct GNUNET_TIME_Absolute timestamp = GNUNET_CHAT_message_get_timestamp( |
@@ -292,7 +356,7 @@ event_joining_contact(MESSENGER_Application *app, | |||
292 | 356 | ||
293 | const gchar *time = GNUNET_STRINGS_absolute_time_to_string(timestamp); | 357 | const gchar *time = GNUNET_STRINGS_absolute_time_to_string(timestamp); |
294 | 358 | ||
295 | gtk_label_set_text(message->text_label, join_message); | 359 | gtk_label_set_text(message->text_label, presence_message); |
296 | gtk_label_set_text(message->timestamp_label, time? time : ""); | 360 | gtk_label_set_text(message->timestamp_label, time? time : ""); |
297 | 361 | ||
298 | ui_chat_add_message(handle->chat, app, message); | 362 | ui_chat_add_message(handle->chat, app, message); |
@@ -370,7 +434,8 @@ event_invitation(MESSENGER_Application *app, | |||
370 | context, | 434 | context, |
371 | contact, | 435 | contact, |
372 | invite_message, | 436 | invite_message, |
373 | "mail-message-new-symbolic" | 437 | "mail-message-new-symbolic", |
438 | "im.received" | ||
374 | ); | 439 | ); |
375 | 440 | ||
376 | gtk_label_set_text(message->text_label, invite_message); | 441 | gtk_label_set_text(message->text_label, invite_message); |
@@ -441,7 +506,8 @@ event_receive_message(MESSENGER_Application *app, | |||
441 | context, | 506 | context, |
442 | contact, | 507 | contact, |
443 | text, | 508 | text, |
444 | "mail-unread-symbolic" | 509 | "mail-unread-symbolic", |
510 | "im.received" | ||
445 | ); | 511 | ); |
446 | 512 | ||
447 | gtk_label_set_text(message->text_label, text? text : ""); | 513 | gtk_label_set_text(message->text_label, text? text : ""); |
diff --git a/src/event.h b/src/event.h index 59dd348..505309c 100644 --- a/src/event.h +++ b/src/event.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2021 GNUnet e.V. | 3 | Copyright (C) 2021--2022 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -28,6 +28,11 @@ | |||
28 | #include "application.h" | 28 | #include "application.h" |
29 | 29 | ||
30 | void | 30 | void |
31 | event_handle_warning(MESSENGER_Application *app, | ||
32 | struct GNUNET_CHAT_Context *context, | ||
33 | const struct GNUNET_CHAT_Message *msg); | ||
34 | |||
35 | void | ||
31 | event_refresh_accounts(MESSENGER_Application *app); | 36 | event_refresh_accounts(MESSENGER_Application *app); |
32 | 37 | ||
33 | void | 38 | void |
@@ -39,9 +44,9 @@ event_update_chats(MESSENGER_Application *app, | |||
39 | const struct GNUNET_CHAT_Message *msg); | 44 | const struct GNUNET_CHAT_Message *msg); |
40 | 45 | ||
41 | void | 46 | void |
42 | event_joining_contact(MESSENGER_Application *app, | 47 | event_presence_contact(MESSENGER_Application *app, |
43 | struct GNUNET_CHAT_Context *context, | 48 | struct GNUNET_CHAT_Context *context, |
44 | const struct GNUNET_CHAT_Message *msg); | 49 | const struct GNUNET_CHAT_Message *msg); |
45 | 50 | ||
46 | void | 51 | void |
47 | event_update_contacts(MESSENGER_Application *app, | 52 | event_update_contacts(MESSENGER_Application *app, |
diff --git a/src/ui/accounts.c b/src/ui/accounts.c index 969c23d..84e932e 100644 --- a/src/ui/accounts.c +++ b/src/ui/accounts.c | |||
@@ -95,11 +95,11 @@ handle_dialog_destroy(UNUSED GtkWidget *window, | |||
95 | { | 95 | { |
96 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; | 96 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; |
97 | 97 | ||
98 | ui_accounts_dialog_cleanup(&(app->ui.accounts)); | 98 | if ((app->ui.accounts.show_queued) || |
99 | (gtk_widget_is_visible(GTK_WIDGET(app->ui.messenger.main_window)))) | ||
100 | return; | ||
99 | 101 | ||
100 | if ((!(app->ui.accounts.show_queued)) && | 102 | gtk_widget_destroy(GTK_WIDGET(app->ui.messenger.main_window)); |
101 | (!gtk_widget_is_visible(GTK_WIDGET(app->ui.messenger.main_window)))) | ||
102 | gtk_widget_destroy(GTK_WIDGET(app->ui.messenger.main_window)); | ||
103 | } | 103 | } |
104 | 104 | ||
105 | static int | 105 | static int |
@@ -219,5 +219,5 @@ ui_accounts_dialog_cleanup(UI_ACCOUNTS_Handle *handle) | |||
219 | { | 219 | { |
220 | g_object_unref(handle->builder); | 220 | g_object_unref(handle->builder); |
221 | 221 | ||
222 | handle->accounts_listbox = NULL; | 222 | memset(handle, 0, sizeof(*handle)); |
223 | } | 223 | } |
diff --git a/src/ui/contacts.c b/src/ui/contacts.c index 68d18b4..5898fde 100644 --- a/src/ui/contacts.c +++ b/src/ui/contacts.c | |||
@@ -241,5 +241,5 @@ ui_contacts_dialog_cleanup(UI_CONTACTS_Handle *handle) | |||
241 | { | 241 | { |
242 | g_object_unref(handle->builder); | 242 | g_object_unref(handle->builder); |
243 | 243 | ||
244 | handle->contacts_listbox = NULL; | 244 | memset(handle, 0, sizeof(*handle)); |
245 | } | 245 | } |
diff --git a/src/ui/delete_messages.c b/src/ui/delete_messages.c index 300c42e..1d6b812 100644 --- a/src/ui/delete_messages.c +++ b/src/ui/delete_messages.c | |||
@@ -149,4 +149,6 @@ void | |||
149 | ui_delete_messages_dialog_cleanup(UI_DELETE_MESSAGES_Handle *handle) | 149 | ui_delete_messages_dialog_cleanup(UI_DELETE_MESSAGES_Handle *handle) |
150 | { | 150 | { |
151 | g_object_unref(handle->builder); | 151 | g_object_unref(handle->builder); |
152 | |||
153 | memset(handle, 0, sizeof(*handle)); | ||
152 | } | 154 | } |
diff --git a/src/ui/invite_contact.c b/src/ui/invite_contact.c index 272550f..8d410bc 100644 --- a/src/ui/invite_contact.c +++ b/src/ui/invite_contact.c | |||
@@ -233,5 +233,5 @@ ui_invite_contact_dialog_cleanup(UI_INVITE_CONTACT_Handle *handle) | |||
233 | { | 233 | { |
234 | g_object_unref(handle->builder); | 234 | g_object_unref(handle->builder); |
235 | 235 | ||
236 | handle->contacts_listbox = NULL; | 236 | memset(handle, 0, sizeof(*handle)); |
237 | } | 237 | } |
diff --git a/src/ui/messenger.c b/src/ui/messenger.c index 270360d..633920c 100644 --- a/src/ui/messenger.c +++ b/src/ui/messenger.c | |||
@@ -275,6 +275,7 @@ handle_main_window_destroy(UNUSED GtkWidget *window, | |||
275 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; | 275 | MESSENGER_Application *app = (MESSENGER_Application*) user_data; |
276 | 276 | ||
277 | ui_messenger_cleanup(&(app->ui.messenger)); | 277 | ui_messenger_cleanup(&(app->ui.messenger)); |
278 | ui_accounts_dialog_cleanup(&(app->ui.accounts)); | ||
278 | 279 | ||
279 | application_exit(app, MESSENGER_QUIT); | 280 | application_exit(app, MESSENGER_QUIT); |
280 | } | 281 | } |
diff --git a/src/ui/new_account.c b/src/ui/new_account.c index 6642261..2778825 100644 --- a/src/ui/new_account.c +++ b/src/ui/new_account.c | |||
@@ -188,4 +188,6 @@ void | |||
188 | ui_new_account_dialog_cleanup(UI_NEW_ACCOUNT_Handle *handle) | 188 | ui_new_account_dialog_cleanup(UI_NEW_ACCOUNT_Handle *handle) |
189 | { | 189 | { |
190 | g_object_unref(handle->builder); | 190 | g_object_unref(handle->builder); |
191 | |||
192 | memset(handle, 0, sizeof(*handle)); | ||
191 | } | 193 | } |
diff --git a/src/ui/new_contact.c b/src/ui/new_contact.c index 6438331..7d5d395 100644 --- a/src/ui/new_contact.c +++ b/src/ui/new_contact.c | |||
@@ -393,8 +393,6 @@ ui_new_contact_dialog_cleanup(UI_NEW_CONTACT_Handle *handle) | |||
393 | if (0 != handle->idle_processing) | 393 | if (0 != handle->idle_processing) |
394 | g_source_remove(handle->idle_processing); | 394 | g_source_remove(handle->idle_processing); |
395 | 395 | ||
396 | handle->idle_processing = 0; | ||
397 | |||
398 | g_signal_handler_disconnect( | 396 | g_signal_handler_disconnect( |
399 | handle->id_drawing_area, | 397 | handle->id_drawing_area, |
400 | handle->id_draw_signal | 398 | handle->id_draw_signal |
@@ -405,8 +403,8 @@ ui_new_contact_dialog_cleanup(UI_NEW_CONTACT_Handle *handle) | |||
405 | if (handle->image) | 403 | if (handle->image) |
406 | zbar_image_destroy(handle->image); | 404 | zbar_image_destroy(handle->image); |
407 | 405 | ||
408 | handle->image = NULL; | ||
409 | |||
410 | zbar_image_scanner_destroy(handle->scanner); | 406 | zbar_image_scanner_destroy(handle->scanner); |
411 | zbar_video_destroy(handle->video); | 407 | zbar_video_destroy(handle->video); |
408 | |||
409 | memset(handle, 0, sizeof(*handle)); | ||
412 | } | 410 | } |
diff --git a/src/ui/new_group.c b/src/ui/new_group.c index d2b287e..6b60145 100644 --- a/src/ui/new_group.c +++ b/src/ui/new_group.c | |||
@@ -313,4 +313,6 @@ ui_new_group_dialog_cleanup(UI_NEW_GROUP_Handle *handle) | |||
313 | 313 | ||
314 | if (handle->contact_entries) | 314 | if (handle->contact_entries) |
315 | g_list_free(handle->contact_entries); | 315 | g_list_free(handle->contact_entries); |
316 | |||
317 | memset(handle, 0, sizeof(*handle)); | ||
316 | } | 318 | } |
diff --git a/src/ui/new_lobby.c b/src/ui/new_lobby.c index 0a9fe37..e75c371 100644 --- a/src/ui/new_lobby.c +++ b/src/ui/new_lobby.c | |||
@@ -198,7 +198,7 @@ handle_id_drawing_area_draw(GtkWidget* drawing_area, | |||
198 | const guint w = handle->qr->width; | 198 | const guint w = handle->qr->width; |
199 | const guint w2 = w + m * 2; | 199 | const guint w2 = w + m * 2; |
200 | 200 | ||
201 | guchar pixels [w2 * w2 * 3]; | 201 | guchar *pixels = (guchar*) g_malloc(sizeof(guchar) * w2 * w2 * 3); |
202 | 202 | ||
203 | guint x, y, z; | 203 | guint x, y, z; |
204 | for (y = 0; y < w2; y++) | 204 | for (y = 0; y < w2; y++) |
@@ -263,10 +263,11 @@ handle_id_drawing_area_draw(GtkWidget* drawing_area, | |||
263 | g_object_unref(scaled); | 263 | g_object_unref(scaled); |
264 | g_object_unref(image); | 264 | g_object_unref(image); |
265 | 265 | ||
266 | g_free(pixels); | ||
267 | |||
266 | return FALSE; | 268 | return FALSE; |
267 | } | 269 | } |
268 | 270 | ||
269 | |||
270 | void | 271 | void |
271 | ui_new_lobby_dialog_init(MESSENGER_Application *app, | 272 | ui_new_lobby_dialog_init(MESSENGER_Application *app, |
272 | UI_NEW_LOBBY_Handle *handle) | 273 | UI_NEW_LOBBY_Handle *handle) |
@@ -386,7 +387,6 @@ ui_new_lobby_dialog_init(MESSENGER_Application *app, | |||
386 | ); | 387 | ); |
387 | } | 388 | } |
388 | 389 | ||
389 | |||
390 | void | 390 | void |
391 | ui_new_lobby_dialog_cleanup(UI_NEW_LOBBY_Handle *handle) | 391 | ui_new_lobby_dialog_cleanup(UI_NEW_LOBBY_Handle *handle) |
392 | { | 392 | { |
diff --git a/src/ui/new_platform.c b/src/ui/new_platform.c index 8611432..5eea8d5 100644 --- a/src/ui/new_platform.c +++ b/src/ui/new_platform.c | |||
@@ -173,4 +173,6 @@ void | |||
173 | ui_new_platform_dialog_cleanup(UI_NEW_PLATFORM_Handle *handle) | 173 | ui_new_platform_dialog_cleanup(UI_NEW_PLATFORM_Handle *handle) |
174 | { | 174 | { |
175 | g_object_unref(handle->builder); | 175 | g_object_unref(handle->builder); |
176 | |||
177 | memset(handle, 0, sizeof(*handle)); | ||
176 | } | 178 | } |
diff --git a/src/ui/send_file.c b/src/ui/send_file.c index 991e8ce..b2e6bb0 100644 --- a/src/ui/send_file.c +++ b/src/ui/send_file.c | |||
@@ -378,4 +378,6 @@ ui_send_file_dialog_cleanup(UI_SEND_FILE_Handle *handle) | |||
378 | ); | 378 | ); |
379 | 379 | ||
380 | g_object_unref(handle->builder); | 380 | g_object_unref(handle->builder); |
381 | |||
382 | memset(handle, 0, sizeof(*handle)); | ||
381 | } | 383 | } |
diff --git a/src/ui/settings.c b/src/ui/settings.c index 6863968..7583941 100644 --- a/src/ui/settings.c +++ b/src/ui/settings.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2021 GNUnet e.V. | 3 | Copyright (C) 2021--2022 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -62,4 +62,6 @@ void | |||
62 | ui_settings_dialog_cleanup(UI_SETTINGS_Handle *handle) | 62 | ui_settings_dialog_cleanup(UI_SETTINGS_Handle *handle) |
63 | { | 63 | { |
64 | g_object_unref(handle->builder); | 64 | g_object_unref(handle->builder); |
65 | |||
66 | memset(handle, 0, sizeof(*handle)); | ||
65 | } | 67 | } |