aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2022-11-14 02:30:15 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2022-11-14 02:30:15 +0100
commitf6096c1762cffc7ee23f70dbdb70b79a90b1c4e1 (patch)
treead55bec4f60c120ab20c047c8d3edf441423cf9c /src
parent790193d7f837b75b9f932b0ca313dacce3c005f9 (diff)
downloadmessenger-gtk-f6096c1762cffc7ee23f70dbdb70b79a90b1c4e1.tar.gz
messenger-gtk-f6096c1762cffc7ee23f70dbdb70b79a90b1c4e1.zip
Fix potential crash by unsafe gst pipeline and improve unicode character handling
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/ui/new_contact.c6
-rw-r--r--src/ui/picker.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/src/ui/new_contact.c b/src/ui/new_contact.c
index 6579125..562219e 100644
--- a/src/ui/new_contact.c
+++ b/src/ui/new_contact.c
@@ -176,6 +176,9 @@ _setup_gst_pipeline(UI_NEW_CONTACT_Handle *handle)
176 NULL 176 NULL
177 ); 177 );
178 178
179 if (!(handle->pipeline))
180 return;
181
179 handle->source = gst_bin_get_by_name( 182 handle->source = gst_bin_get_by_name(
180 GST_BIN(handle->pipeline), "source" 183 GST_BIN(handle->pipeline), "source"
181 ); 184 );
@@ -190,6 +193,9 @@ _setup_gst_pipeline(UI_NEW_CONTACT_Handle *handle)
190 193
191 GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(handle->pipeline)); 194 GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(handle->pipeline));
192 195
196 if (!bus)
197 return;
198
193 gst_bus_add_signal_watch(bus); 199 gst_bus_add_signal_watch(bus);
194 200
195 g_signal_connect( 201 g_signal_connect(
diff --git a/src/ui/picker.c b/src/ui/picker.c
index bdaa713..09ccf09 100644
--- a/src/ui/picker.c
+++ b/src/ui/picker.c
@@ -51,10 +51,14 @@ _add_emoji_buttons(GtkFlowBox *flow_box,
51 GString *string = g_string_new(""); 51 GString *string = g_string_new("");
52 g_string_append_unichar(string, (gunichar) characters[i]); 52 g_string_append_unichar(string, (gunichar) characters[i]);
53 53
54 gchar *_text = g_locale_to_utf8(string->str, string->len, NULL, NULL, NULL);
55
54 GtkButton *emoji_button = GTK_BUTTON( 56 GtkButton *emoji_button = GTK_BUTTON(
55 gtk_button_new_with_label(string->str) 57 gtk_button_new_with_label(string->str)
56 ); 58 );
57 59
60 g_free(_text);
61
58 gtk_button_set_relief(emoji_button, GTK_RELIEF_NONE); 62 gtk_button_set_relief(emoji_button, GTK_RELIEF_NONE);
59 63
60 g_signal_connect( 64 g_signal_connect(