Re: SIGSEGV in gtk_main_quit()

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

 



Thanks for the help Viraj.
I understood my error. Along with that I should also not call
gtk_main() while doing a gtk_dialog_run().

Thanks,
Mohit 


On 7/25/05, Viraj Chatterjee <vchatter@xxxxxxxxx> wrote:
> 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@xxxxxxxxx>
> To: <gtk-list@xxxxxxxxx>
> 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@xxxxxxxxx
> http://mail.gnome.org/mailman/listinfo/gtk-list 
> 
>
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux