开发者

Gtk::MessageDialog Run throws a segmentation fault

开发者 https://www.devze.com 2022-12-18 15:12 出处:网络
Hi I\'m trying to show an error mesaage using a dialogbox. However when I run the code I get segm开发者_如何学Pythonentation fault.

Hi I'm trying to show an error mesaage using a dialogbox. However when I run the code I get segm开发者_如何学Pythonentation 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.


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.


maybe you did not added this line at the begining?

Gtk::Main_kit(argc, argv);
0

精彩评论

暂无评论...
验证码 换一张
取 消