diff options
author | Owen Taylor <otaylor@redhat.com> | 2002-02-13 17:48:01 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2002-02-13 17:48:01 +0000 |
commit | 6b838a22d1e55ed50d079f7a7eca8afdd3714ddc (patch) | |
tree | a91e5ffee40c9f8affcf0e9dfd2d8005faf333b9 /gdk/x11/gdkselection-x11.c | |
parent | 294e8eb7bbb62620afb2d5a76408f4671018deb0 (diff) | |
download | gtk+-6b838a22d1e55ed50d079f7a7eca8afdd3714ddc.tar.gz |
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.
Diffstat (limited to 'gdk/x11/gdkselection-x11.c')
-rw-r--r-- | gdk/x11/gdkselection-x11.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index 893d475ce1..def7c65930 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -305,21 +305,30 @@ gdk_text_property_to_text_list (GdkAtom encoding, XTextProperty property; gint count = 0; gint res; - - if (!list) - return 0; + gchar **local_list; property.value = (guchar *)text; property.encoding = gdk_x11_atom_to_xatom (encoding); property.format = format; property.nitems = length; - res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, list, &count); + res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, &local_list, &count); - if (res == XNoMemory || res == XLocaleNotSupported || - res == XConverterNotFound) - return 0; + if (res == XNoMemory || res == XLocaleNotSupported || res == XConverterNotFound) + { + if (list) + *list = NULL; + + return 0; + } else - return count; + { + if (list) + *list = local_list; + else + XFreeStringList (local_list); + + return count; + } } void @@ -482,8 +491,10 @@ gdk_text_property_to_utf8_list (GdkAtom encoding, (*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; return count; |