GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

gtk_dialog_run call crashes program

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
mikemio



Joined: 15 May 2008
Posts: 3

PostPosted: Thu May 15, 2008 1:07 am    Post subject: gtk_dialog_run call crashes program Reply with quote

Hello there. I have a small dialog window i have created with two labels, two entries, and an OK and Cancel button. I have gotten this window to work fine on one machine but when I moved the code over to another machine, it compiles fine, but then my program crashes when i call gtk_dialog_run() to bring up the window. All the machines I am using are running Redhat linux and I am developing in C++.

Does anyone have any ideas on what I should try to fix this? I am very confused as to why this is happening since these two machines are very similar. They are both Dell laptops running Red Hat linux and they both are running the same version of GTK.

Thank you very much for the help!
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 495
Location: Portland, OR USA

PostPosted: Thu May 15, 2008 3:26 pm    Post subject: Reply with quote

Do you know exactly where it is crashing? Is it a segmentation fault?

Try running it through gdb with a breakpoint in the function that calls the dialog. Let's assume 'on_button_click' opens the dialog.

Code: (Plaintext)
1
2
3
gdb myprogram
b on_button_click
r


Then your program will run like normal, But when you click the button your application will halt at on_button_click shown in the terminal where you can step through it by pressing the 'n' key. When your program crashes, you'll have more info to work off of.
Back to top
mikemio



Joined: 15 May 2008
Posts: 3

PostPosted: Thu May 15, 2008 3:45 pm    Post subject: Reply with quote

Thanks for the reply Micah.

So I have narrowed down the problem somewhat. If I create the Dialog Window without any buttons, the window opens up fine. However, when I add the buttons to the window, that is when it crashes. I am using the gtk_dialog_new_with_buttons() call to create the window and I am trying to create it using just the GTK_STOCK_OK and GTK_STOCK_CANCEL buttons. The program crashes on the call to gtk_dialog_run().

Thanks again for the help.
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 495
Location: Portland, OR USA

PostPosted: Thu May 15, 2008 4:01 pm    Post subject: Reply with quote

That's odd. Can you paste in the whole bit? Is it giving any assering errors in the output? Or just crashing without any warning?
Back to top
mikemio



Joined: 15 May 2008
Posts: 3

PostPosted: Thu May 15, 2008 4:20 pm    Post subject: Reply with quote

It looks like there is a problem with using the GTK_STOCK buttons. I created my dialog window without adding buttons with the gtk_dialog_new_with_buttons() call. Instead, I added a button separately to the dialog with the gtk_button_new_from_stock() function. Adding a STOCK button this way caused the program to crash as well. When I added a button to the dialog window using the gtk_button_new() function, the button was added and the dialog opened fine.

Is there a chance these STOCK buttons are corrupt or something? Is there any easy way to reinstall this portion of GTK?

Thanks again for the help.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP