How to use GtkTextView correctly



Hello,

I don't know whether this is a bug in my program or in GTK+.  In
either case, I'd like to know what's wrong with it.

---------

Compile the file "a.c" with:

gcc -Wall -Werror -ggdb3 `pkg-config --cflags gtk+-2.0` a.c -o ./a
`pkg-config --libs gtk+-2.0`

Execute the program, type in text into the box, select the text with
the mouse, close the window by clicking on "X" in the WM.  A SIGSEGV
happens.  

--------------a.c-------------------
#include <gtk/gtk.h>

int main(int c, char **v)
{
        gtk_init(&c, &v); 
        GtkWidget *text_view= gtk_text_view_new();
        GtkWidget *window= gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_widget_show(window);
        gtk_container_add(GTK_CONTAINER(window), text_view);
        gtk_widget_show(text_view);
        gtk_main();

        return 0;
}
-----------------------------------

GTK+ version taken from gtkversion.h:  2.1.0

~ $ uname -a
SunOS bueno 5.9 Generic_112233-08 sun4u sparc SUNW,Sun-Fire-880
~ $ gcc --version
gcc (GCC) 3.3.1

~ $ ./a

(a:26506): GLib-GObject-CRITICAL **: file gobject.c: line 1290: assertion `object->ref_count > 0' failed
Erreur de segmentation (core dumped)

["Erreur de segmentation" means segmentation fault in french.]

---
Thank You,

        Jerome KUNEGIS



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]