views:

183

answers:

2

Hi I'm trying to show an error mesaage using a dialogbox. However when I run the code I get segmentation fault.

Here's the function:

void ShowErrorMessage(string message)
{
  Gtk::MessageDialog dialog(message,true,Gtk::MESSAGE_ERROR,Gtk::BUTTONS_CLOSE,true);
  dialog.run();
}

I try to open a file, if the file can not be open I wanna show this error box, however i keep running into segmentation fault.

A: 

Do you have to call new on the dialog or is that a static class? See here for the document on this, which is leading me to think that's why your code segfaults...

Hope this helps, Best regards, Tom.

tommieb75
Hi tom - no I dont need to call new..i'm using gtkmm
ace
A: 

maybe you did not added this line at the begining?

Gtk::Main_kit(argc, argv);
ali
I do have this line added, before I call the error message function.
ace