Re: SIGSEGV in gtk_main_quit()
- From: Viraj Chatterjee <vchatter adobe com>
- To: Mohit Kumar <mohit kumar gmail com>, gtk-list gnome org
- Cc:
- Subject: Re: SIGSEGV in gtk_main_quit()
- Date: Mon, 25 Jul 2005 19:44:39 +0530
You shouldn't do a gtk_main_quit() if you're using the gtk_dialog_run, since
that itself maintains a loop for you, and when a certain condition occurs,
it exits the loop for you.
-vc
----- Original Message -----
From: "Mohit Kumar" <mohit kumar gmail com>
To: <gtk-list gnome org>
Sent: Monday, July 25, 2005 7:28 PM
Subject: SIGSEGV in gtk_main_quit()
Hi All,
I have written the following piece of code:
#include <gtk/gtk.h>
int mainDialog()
{
GtkWidget *window;
window = gtk_file_chooser_dialog_new("Save File", NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_SAVE,GTK_RESPONSE_OK,NULL);
if(gtk_dialog_run(GTK_DIALOG(window)) == GTK_RESPONSE_OK)
{
char *filename;
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(window));
printf("File name :%s",filename);
g_free(filename);
}
gtk_widget_destroy(window);
gtk_main_quit();
}
int main(int argc, char*argv[])
{
gtk_init(&argc,&argv);
mainDialog();
gtk_main();
return 0;
}
And I am getting a SIGSEGV when gtk_main_quit() executes. The gdb output is:
Program received signal SIGSEGV, Segmentation fault.
0x4012656d in gtk_main_quit () at gtkmain.c:1233
warning: Source file is more recent than executable.
1233 g_main_loop_quit (main_loops->data);
(gdb) bt 5
#0 0x4012656d in gtk_main_quit () at gtkmain.c:1233
#1 0x0804888c in mainDialog () at sample.c:17
#2 0x080488b6 in main (argc=1, argv=0xbfffecc4) at sample.c:25
Could any one please tell me what mistake I am doing?
Thanks,
Mohit
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]