GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Dec 19, 2014 12:36 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: gtk_dialog_run call crashes program
PostPosted: Thu May 15, 2008 1:07 am 
Offline

Joined: Thu May 15, 2008 12:51 am
Posts: 3
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!


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 15, 2008 3:26 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
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=]gdb myprogram
b on_button_click
r[/code]

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.

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 15, 2008 3:45 pm 
Offline

Joined: Thu May 15, 2008 12:51 am
Posts: 3
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 15, 2008 4:01 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
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?

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 15, 2008 4:20 pm 
Offline

Joined: Thu May 15, 2008 12:51 am
Posts: 3
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group