Re: gtk_entry_get_text + strange Segmentation fault
- From: Darin Adler <darin bentspoon com>
- To: Marc Bruenink <marc bruenink de>, <gtk-app-devel-list gnome org>
- Subject: Re: gtk_entry_get_text + strange Segmentation fault
- Date: Wed, 05 Dec 2001 14:30:12 -0800
On 12/5/01 2:25 PM, "Marc Bruenink" <marc bruenink de> wrote:
cBuffer = gtk_entry_get_text(GTK_ENTRY(input));
free(cBuffer);
[...]
If i comment
cBuffer = gtk_entry_get_text(GTK_ENTRY(configInput1));
out, everything works fine. But if i use this line i get a "Segmentation
fault" AFTER correct execution of win::WindowOKButtonClicked.
I've no $%&/ clue why this appears.
Any suggestions??
Don't free the result of gtk_entry_get_text. As it says on this page
<http://developer.gnome.org/doc/API/gtk/gtkentry.html>: "The returned
pointer points to internally allocated storage in the widget and must not be
freed, modified or stored. For this reason, this function is deprecated. Use
gtk_editable_get_chars() instead."
Also, if you are going to free something from gtk, you have to use g_free(),
not free(), although you can "get away" with calling free() if you don't
ever use any interesting debugging modes.
-- Darin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]