summaryrefslogtreecommitdiff
path: root/gdk/x11/gdkselection-x11.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2004-11-26 05:43:38 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-11-26 05:43:38 +0000
commit54c67437872d943d425f22ab33621feae7d2fd3c (patch)
tree37ca1d6093c0cd955fa56b2fc87a1d19a1bed098 /gdk/x11/gdkselection-x11.c
parent1d99ca890a5404943f3d1bd5eeaea83cde33bd00 (diff)
downloadgtk+-54c67437872d943d425f22ab33621feae7d2fd3c.tar.gz
Don't crash if Xlib fails to return UTF-8. (#159373, Kristian Høgsberg)
2004-11-26 Matthias Clasen <mclasen@redhat.com> * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list_for_display): Don't crash if Xlib fails to return UTF-8. (#159373, Kristian Høgsberg)
Diffstat (limited to 'gdk/x11/gdkselection-x11.c')
-rw-r--r--gdk/x11/gdkselection-x11.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c
index 13aca15cea..06374c5cf6 100644
--- a/gdk/x11/gdkselection-x11.c
+++ b/gdk/x11/gdkselection-x11.c
@@ -643,14 +643,20 @@ gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
else
{
if (list)
- (*list)[count++] = g_strdup (local_list[i]);
+ {
+ if (g_utf8_validate (local_list[i], -1, NULL))
+ (*list)[count++] = g_strdup (local_list[i]);
+ else
+ g_warning ("Error converting selection");
+ }
}
}
if (local_count)
gdk_free_text_list (local_list);
- (*list)[count] = NULL;
+ if (list)
+ (*list)[count] = NULL;
return count;
}