Re: gtk_widget_destroy goes SIGSEGV
- From: David Nečas (Yeti) <yeti physics muni cz>
- To: gtk-list gnome org
- Subject: Re: gtk_widget_destroy goes SIGSEGV
- Date: Wed, 5 Jul 2006 03:27:14 +0200
On Tue, Jul 04, 2006 at 08:20:33PM -0400, Yoandy Rodriguez Martinez wrote:
> I'm making a small Gtk application and this function (code sample below )
> keeps doing segfaults when gtk_widget_destroy is called. Any tip???
>
> void message_dialog(const gchar * message){
> /*
> * Santa ayuda de Gtk
> */
>
> GtkWidget *dialog;
>
> /* Create the widgets */
>
> dialog = gtk_message_dialog_new (NULL,
> GTK_DIALOG_DESTROY_WITH_PARENT,
> GTK_MESSAGE_ERROR,
> GTK_BUTTONS_CLOSE,
> "%s",
> message);
>
> /* Add the label, and show everything we've added to the dialog. */
> gtk_dialog_run(GTK_DIALOG(dialog));
> gtk_widget_destroy(dialog);
> }
The code is correct, except it makes little sense to pass
GTK_DIALOG_DESTROY_WITH_PARENT when parent is NULL and if
the dialog can be destroyed by something else while it's
running (I suppose it cannot) the return value of
gtk_dialog_run() has to be checked for GTK_RESPONSE_NONE.
So, I have two tips:
1. Use gdb, at least to get a backtrace.
2. Use valgrind.
Maybe you will find it actually crashes elsewhere. If you
did use a debugger and are sure it crashes in the
gtk_widget_destroy() why you didn't post the backtrace
which would reveal where excactly it crashes?
Yeti
--
Anonyms eat their boogers.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]