GtkTextBuffer "destroying"



I can not seem to destroy a GtkTextBuffer created by calling
gtk_text_buffer_new.
To test my problem I used a function like below:

somefunction()
{
 	GtkTextTagTable *tt = gtk_text_tag_table_new();               
 	GtkTextBuffer *buffer = gtk_text_buffer_new(tt);     
 	gint n = gtk_text_buffer_get_line_count(buffer);
 	gtk_widget_destroy(GTK_WIDGET(buffer));
}

I have tried to cast "buffer" to G_OBJECT,GTK_TEXT_BUFFER,and GTK_OBJECT
with no joy.

At runtime I receive:
 gtk CRITICAL gtk_widget_destroy assumtion GTK_IS_WIDGET(widget) failed.

The Buffer is created ie. the line count returns '1'.

Thanks in advance for any help.




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