Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-23-2007, 12:41 AM   #1
LQ Newbie
Registered: Aug 2006
Posts: 13

Rep: Reputation: 0
Problem on gtk-sheet....

I am using gtk_sheet. I am getting some segmentation fault when I create a sheet repeatedly.... I am giving the code here....

When I run the below C-code it pops up the one main window and the sheet dialog
the main window contains the button labelled Destroy & Create, which destroys the sheet dialog and creates a new sheet dialog for hundred times, when i keep on clicking the button it crashes at some point...

My system specifications :
OS: Linux Federo core 3
Kernel: 2.6.12-prep athlon i386 GNU/Linux
gtk version : gtk2-2.4.13-9
gtk sheet package : gtk+extra-2.1.1
gcc version 3.4.2

please let me know what the mistake I am doing.....,

Thanks in advance

GtkWidget *sheet_dialog_window;
GtkWidget *sheet;

/*Craets a sheet and packs to the dialog vbox*/
void create_sheet()
gtk_widget_set_size_request(sheet_dialog_window,85 0,700);


gtk_box_pack_start(GTK_BOX(GTK_DIALOG(sheet_dialog _window)->vbox),sheet,TRUE,TRUE,0);


/*Destroy's and create's the sheet for 100 times*/
void Destroy_and_create_callback(GtkWidget *w,gpointer d)
int i=0;

int main(int argc,char *argv[])
GtkWidget *w,*b;


gtk_widget_set_size_request (GTK_WIDGET (w), 400, 400);

b=gtk_button_new_with_label("Destroy & Create");
g_signal_connect(b,"clicked",G_CALLBACK(Destroy_an d_create_callback),NULL);


g_signal_connect(w,"destroy",G_CALLBACK(gtk_main_q uit),NULL);

return 0;
Old 04-23-2007, 05:33 PM   #2
Senior Member
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
It's possible that it isn't done with one of the destroy/create loops when you click on the button again. That's the only thing I can think of because I don't see anything else in your code that would cause that. You should disable the button at the beginning of 'Destroy_and_create_callback' and enable it again when it's complete.
Old 04-24-2007, 05:35 AM   #3
LQ Newbie
Registered: Aug 2006
Posts: 13

Original Poster
Rep: Reputation: 0
Is there any chance of memory problem in the gtk_sheet itself??? and in my code there is no need of 100 times loop if u destroy and create once then also it gives the segfault

Last edited by lkg; 04-24-2007 at 05:38 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Music sheet program? enemorales Linux - Software 3 11-26-2005 09:49 PM
gtk+ 2.4.14 problem, how do I execute GTK? nautal Linux - Software 2 06-17-2005 06:09 PM
Scoring sheet music ? michaelsanford Linux - Software 5 05-10-2005 12:53 PM
Safari Style Sheet Problem atomicx Programming 2 05-03-2005 12:21 AM
Sheet Music software tyg Linux - Software 5 12-26-2003 10:38 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:04 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration