The problem is you've created your Gtk::MessageDialog
on the stack in int main
. Since that function won't exit until your program does your MessageDialog
hangs around.
Few options:
1.) Hide the dialog when done with it, it'll be destroyed when int main exits.
2.) New it then delete it.
Gtk::MessageDialog* dialog = new Gtk::MessageDialog("Info", false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO);
dialog->set_secondary_text( "Dialog");
dialog->set_default_response(Gtk::RESPONSE_YES);
dialog->run();
delete dialog;
3.) Create it in it's own function or block so it'll be destroyed when that scope exits.
void showDialog() {
Gtk::MessageDialog dialog("Info", false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO);
dialog.set_secondary_text( "Dialog");
dialog.set_default_response(Gtk::RESPONSE_YES);
dialog.run();
}
int main(int argc, char *argv[]) {
etc...
showDialog();
Gtk::Main::run(client);
etc...
}