Skip to content

Commit 1268738

Browse files
committed
Merge remote-tracking branch 'dept/windows'
2 parents 1300f1d + 22b8442 commit 1268738

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

frontend/gtkmm/main.cc

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#ifdef _WIN32
1010
#include <Windows.h>
11+
#include <stdlib.h>
1112
#endif
1213

1314
// Cadabra frontend with GTK+ interface (using gtkmm).
@@ -20,18 +21,35 @@ int main(int argc, char **argv)
2021
const int status = application->run();
2122
return status;
2223
}
23-
catch(Glib::Error& er) {
24+
catch (Glib::Error& er) {
2425
std::cerr << er.what() << std::endl;
2526
return -1;
2627
}
27-
catch(std::exception& ex) {
28+
catch (std::exception& ex) {
2829
std::cerr << ex.what() << std::endl;
2930
}
3031
}
3132

3233
#if defined(_WIN32) && defined(NDEBUG)
3334
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
3435
{
35-
main(0, 0);
36+
try {
37+
auto application = Cadabra::create(__argc, __argv);
38+
const int status = application->run();
39+
return status;
40+
}
41+
catch (Glib::Error& er) {
42+
Gtk::MessageDialog(er.what()).run();
43+
return -1;
44+
}
45+
catch (std::exception& ex) {
46+
Gtk::MessageDialog(ex.what()).run();
47+
return -1;
48+
}
49+
catch (...) {
50+
Gtk::MessageDialog("An unknown error occured :(").run();
51+
throw;
52+
}
3653
}
37-
#endif
54+
#endif
55+

0 commit comments

Comments
 (0)