GNOME Bugzilla – Bug 107590
segmentation fault on GB18030
Last modified: 2004-12-22 21:47:04 UTC
Gtk application dies when certain gb18030 character are used. I've encoded one of these chars to utf16 in order to show the bug. The only pattern I found was that those char that causes gtk to die are encoded in 3 bytes when g_utf16_to_utf8 is used. For chars that are encode in 2 bytes in UTF-8 the problem doesn't happens. (I've used the items_written param of g_utf16_to_utf8 to check this); I believe the conversion process is Ok though. Be sure that the locale of your machine is set to gb18030 before running the test code. Here is my Test Code: #include <gtk/gtk.h> int main (int argc, char** argv) { GtkWidget *shellHandle, *textHandle; gunichar2 buffer[] = {'a', 0xfb4e, 'b'}; //doesn't works // gunichar2 buffer[] = {'a', 0x628, 'b'}; //works gchar* utf8; gtk_init_check (&argc, &argv); shellHandle = gtk_window_new (GTK_WINDOW_TOPLEVEL); textHandle = gtk_entry_new(); gtk_container_add (GTK_CONTAINER (shellHandle), textHandle); utf8 = g_utf16_to_utf8 (buffer, 3, NULL, NULL, NULL); gtk_entry_set_text (GTK_ENTRY(textHandle), utf8); g_free (utf8); g_signal_connect (G_OBJECT (shellHandle), "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect (G_OBJECT (shellHandle), "delete_event",G_CALLBACK (gtk_main_quit), NULL); gtk_widget_show_all (shellHandle); gtk_main(); }
After some more testing I verified that the crash happens on the following funcions: pango_layout_get_size, gdk_draw_layout this is more likely a pango bug I think.
*** This bug has been marked as a duplicate of 103634 ***