aboutsummaryrefslogtreecommitdiff
path: root/src/ui/chat.c
diff options
context:
space:
mode:
authorJacki <jacki@thejackimonster.de>2024-04-22 23:46:32 +0200
committerJacki <jacki@thejackimonster.de>2024-04-22 23:46:32 +0200
commit0df8809142089441c820b27e2fd653ed0c3bc757 (patch)
tree4e69e53a7656ce32d50735bf274c482c8817c213 /src/ui/chat.c
parent3a3d5049bfef54bdaf33f7e184fe437d06c1a209 (diff)
downloadmessenger-gtk-0df8809142089441c820b27e2fd653ed0c3bc757.tar.gz
messenger-gtk-0df8809142089441c820b27e2fd653ed0c3bc757.zip
Fix deallocation issue when multiple threads accessed resources
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat (limited to 'src/ui/chat.c')
-rw-r--r--src/ui/chat.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/ui/chat.c b/src/ui/chat.c
index 177d61c..0cd85da 100644
--- a/src/ui/chat.c
+++ b/src/ui/chat.c
@@ -2036,11 +2036,10 @@ iterate_ui_chat_update_context_media(void *cls,
2036 ); 2036 );
2037 2037
2038 g_object_set_qdata(G_OBJECT(child), closure->app->quarks.data, file); 2038 g_object_set_qdata(G_OBJECT(child), closure->app->quarks.data, file);
2039 g_object_set_qdata_full( 2039 g_object_set_qdata(
2040 G_OBJECT(child), 2040 G_OBJECT(child),
2041 closure->app->quarks.ui, 2041 closure->app->quarks.ui,
2042 handle, 2042 handle
2043 (GDestroyNotify) ui_media_preview_delete
2044 ); 2043 );
2045 2044
2046 gtk_widget_set_size_request(GTK_WIDGET(child), 80, 80); 2045 gtk_widget_set_size_request(GTK_WIDGET(child), 80, 80);
@@ -2065,6 +2064,13 @@ _chat_update_media(UI_CHAT_Handle *handle,
2065 GtkWidget *widget = GTK_WIDGET(item->data); 2064 GtkWidget *widget = GTK_WIDGET(item->data);
2066 item = item->next; 2065 item = item->next;
2067 2066
2067 UI_MEDIA_PREVIEW_Handle *media = g_object_get_qdata(
2068 G_OBJECT(widget),
2069 app->quarks.ui
2070 );
2071
2072 ui_media_preview_delete(media);
2073
2068 gtk_container_remove( 2074 gtk_container_remove(
2069 GTK_CONTAINER(handle->chat_media_flowbox), 2075 GTK_CONTAINER(handle->chat_media_flowbox),
2070 widget 2076 widget
@@ -2289,12 +2295,12 @@ ui_chat_delete(UI_CHAT_Handle *handle)
2289 2295
2290 ui_picker_delete(handle->picker); 2296 ui_picker_delete(handle->picker);
2291 2297
2292 if (handle->loads)
2293 g_list_free_full(handle->loads, (GDestroyNotify) ui_file_load_entry_delete);
2294
2295 _chat_update_contacts(handle, handle->app, NULL); 2298 _chat_update_contacts(handle, handle->app, NULL);
2296 _chat_update_files(handle, handle->app, NULL);
2297 _chat_update_media(handle, handle->app, NULL); 2299 _chat_update_media(handle, handle->app, NULL);
2300 _chat_update_files(handle, handle->app, NULL);
2301
2302 if (handle->loads)
2303 g_list_free_full(handle->loads, (GDestroyNotify) ui_file_load_entry_delete);
2298 2304
2299 g_object_unref(handle->builder); 2305 g_object_unref(handle->builder);
2300 2306