Re: Segmentation fault in code - possible bug?

> Joseph Turner wrote:
> >
> >If I replace the entry widget with a button say, (and other code as well)
> >I can keep pressing the top button without any segmentation fault.
> You shouldn't destroy a widget more than once: it's like free()ing 
> something twice. If it didn't fault with the button there instead of the 
> entry, it's only because you were very lucky :-)

In my code I have a few checks that validate the widget before destroying it.

int close_it(GtkWidget *but, GtkWidget *shet)
 if (GTK_IS_ENTRY(shet) && GTK_IS_WIDGET(shet))
    g_print("destroying entry\n");
//    gtk_widget_destroy(shet);

Naturally, I should see a "destroying entry" everytime I click the button if
indeed it is trying to destroy the widget each click.

You can see here I'm using your previous suggestion the my_destroy routine
which prints out the widget type and then does a gtk_widget_destroy.

It crashes irrespective of whether I call my_destroy or do a straight

Any Ideas?


> John


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