Re: Strange glibc detected invalid pointer with gtk_entry
- From: Emmanuele Bassi <ebassi gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Strange glibc detected invalid pointer with gtk_entry
- Date: Tue, 5 Jul 2011 15:19:00 +0100
On 2011-07-05 at 15:05, zz excite it wrote:
void my_gtk_entry_set_text(GtkEntry *entry, char *data)
{
char *tmp;
if (!data) data = "";
if (g_utf8_validate(data, -1, NULL) != TRUE) {
tmp = g_locale_to_utf8(data, -1, NULL, NULL, NULL);
gtk_entry_set_text(entry, tmp);
xfree(&tmp);
^^^^^^^^^^^^
agh!
g_locale_to_utf8() returns memory allocated through the GLib API; you
need to call g_free() to free it. *do not* mix GLib's memory allocation
functions with other allocation functions.
ciao,
Emmanuele.
--
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]