g_warning() if setting the local fails, like gdk_set_locale() did.

Wed Feb 13 12:41:44 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkmain.c (gtk_init_check): g_warning() if setting
        the local fails, like gdk_set_locale() did.

        * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list):
        Don't free local_list if local_count == 0. (#71241, reported
        by Kevin Vandersloot.)

        * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list):
        Clean up list == NULL handling and failure.
This commit is contained in:
Owen Taylor
2002-02-13 17:48:01 +00:00
committed by Owen Taylor
parent 294e8eb7bb
commit 6b838a22d1
9 changed files with 108 additions and 10 deletions

View File

@ -1,3 +1,15 @@
Wed Feb 13 12:41:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_init_check): g_warning() if setting
the local fails, like gdk_set_locale() did.
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list):
Don't free local_list if local_count == 0. (#71241, reported
by Kevin Vandersloot.)
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list):
Clean up list == NULL handling and failure.
Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com> Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com>
* tests/testtreeview.c (typesystem_recurse): Cast GType * tests/testtreeview.c (typesystem_recurse): Cast GType

View File

@ -1,3 +1,15 @@
Wed Feb 13 12:41:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_init_check): g_warning() if setting
the local fails, like gdk_set_locale() did.
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list):
Don't free local_list if local_count == 0. (#71241, reported
by Kevin Vandersloot.)
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list):
Clean up list == NULL handling and failure.
Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com> Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com>
* tests/testtreeview.c (typesystem_recurse): Cast GType * tests/testtreeview.c (typesystem_recurse): Cast GType

View File

@ -1,3 +1,15 @@
Wed Feb 13 12:41:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_init_check): g_warning() if setting
the local fails, like gdk_set_locale() did.
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list):
Don't free local_list if local_count == 0. (#71241, reported
by Kevin Vandersloot.)
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list):
Clean up list == NULL handling and failure.
Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com> Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com>
* tests/testtreeview.c (typesystem_recurse): Cast GType * tests/testtreeview.c (typesystem_recurse): Cast GType

View File

@ -1,3 +1,15 @@
Wed Feb 13 12:41:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_init_check): g_warning() if setting
the local fails, like gdk_set_locale() did.
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list):
Don't free local_list if local_count == 0. (#71241, reported
by Kevin Vandersloot.)
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list):
Clean up list == NULL handling and failure.
Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com> Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com>
* tests/testtreeview.c (typesystem_recurse): Cast GType * tests/testtreeview.c (typesystem_recurse): Cast GType

View File

@ -1,3 +1,15 @@
Wed Feb 13 12:41:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_init_check): g_warning() if setting
the local fails, like gdk_set_locale() did.
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list):
Don't free local_list if local_count == 0. (#71241, reported
by Kevin Vandersloot.)
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list):
Clean up list == NULL handling and failure.
Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com> Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com>
* tests/testtreeview.c (typesystem_recurse): Cast GType * tests/testtreeview.c (typesystem_recurse): Cast GType

View File

@ -1,3 +1,15 @@
Wed Feb 13 12:41:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_init_check): g_warning() if setting
the local fails, like gdk_set_locale() did.
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list):
Don't free local_list if local_count == 0. (#71241, reported
by Kevin Vandersloot.)
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list):
Clean up list == NULL handling and failure.
Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com> Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com>
* tests/testtreeview.c (typesystem_recurse): Cast GType * tests/testtreeview.c (typesystem_recurse): Cast GType

View File

@ -1,3 +1,15 @@
Wed Feb 13 12:41:44 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmain.c (gtk_init_check): g_warning() if setting
the local fails, like gdk_set_locale() did.
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list):
Don't free local_list if local_count == 0. (#71241, reported
by Kevin Vandersloot.)
* gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list):
Clean up list == NULL handling and failure.
Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com> Wed Feb 13 11:27:31 2002 Owen Taylor <otaylor@redhat.com>
* tests/testtreeview.c (typesystem_recurse): Cast GType * tests/testtreeview.c (typesystem_recurse): Cast GType

View File

@ -305,21 +305,30 @@ gdk_text_property_to_text_list (GdkAtom encoding,
XTextProperty property; XTextProperty property;
gint count = 0; gint count = 0;
gint res; gint res;
gchar **local_list;
if (!list)
return 0;
property.value = (guchar *)text; property.value = (guchar *)text;
property.encoding = gdk_x11_atom_to_xatom (encoding); property.encoding = gdk_x11_atom_to_xatom (encoding);
property.format = format; property.format = format;
property.nitems = length; property.nitems = length;
res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, list, &count); res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, &local_list, &count);
if (res == XNoMemory || res == XLocaleNotSupported || if (res == XNoMemory || res == XLocaleNotSupported || res == XConverterNotFound)
res == XConverterNotFound) {
return 0; if (list)
*list = NULL;
return 0;
}
else else
return count; {
if (list)
*list = local_list;
else
XFreeStringList (local_list);
return count;
}
} }
void void
@ -482,8 +491,10 @@ gdk_text_property_to_utf8_list (GdkAtom encoding,
(*list)[count++] = g_strdup (local_list[i]); (*list)[count++] = g_strdup (local_list[i]);
} }
} }
if (local_count)
gdk_free_text_list (local_list);
gdk_free_text_list (local_list);
(*list)[count] = NULL; (*list)[count] = NULL;
return count; return count;

View File

@ -458,7 +458,10 @@ gtk_init_check (int *argc,
#endif #endif
if (do_setlocale) if (do_setlocale)
setlocale (LC_ALL, ""); {
if (!setlocale (LC_ALL, ""))
g_warning ("Locale not supported by C library.\n\tUsing the fallback 'C' locale.");
}
/* Initialize "gdk". We pass along the 'argc' and 'argv' /* Initialize "gdk". We pass along the 'argc' and 'argv'
* parameters as they contain information that GDK uses * parameters as they contain information that GDK uses