Fix crash in test/cube under macOS when using Quit menubar item
This commit is contained in:
parent
79c3db48cf
commit
66c37e5128
@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
// Modified to have 2 cubes to test multiple OpenGL contexts
|
// Modified to have 2 cubes to test multiple OpenGL contexts
|
||||||
//
|
//
|
||||||
// Copyright 1998-2023 by Bill Spitzak and others.
|
// Copyright 1998-2024 by Bill Spitzak and others.
|
||||||
//
|
//
|
||||||
// This library is free software. Distribution and use rights are outlined in
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
// the file "COPYING" which should have been included with this file. If this
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
@ -162,7 +162,6 @@ int done = 0; // set to 1 in exit button callback
|
|||||||
// exit button callback
|
// exit button callback
|
||||||
void exit_cb(Fl_Widget *w, void *) {
|
void exit_cb(Fl_Widget *w, void *) {
|
||||||
done = 1;
|
done = 1;
|
||||||
w->window()->hide(); // necessary if built w/o GL
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// print screen demo
|
// print screen demo
|
||||||
@ -206,6 +205,7 @@ void makeform(const char *name) {
|
|||||||
|
|
||||||
// main window
|
// main window
|
||||||
form = new Fl_Window(form_w, form_h, name);
|
form = new Fl_Window(form_w, form_h, name);
|
||||||
|
form->callback(exit_cb);
|
||||||
// menu bar
|
// menu bar
|
||||||
Fl_Sys_Menu_Bar *menubar = new Fl_Sys_Menu_Bar(0, 0, form_w, MENUBAR_H);
|
Fl_Sys_Menu_Bar *menubar = new Fl_Sys_Menu_Bar(0, 0, form_w, MENUBAR_H);
|
||||||
menubar->add("File/Print window", FL_COMMAND+'p', print_cb);
|
menubar->add("File/Print window", FL_COMMAND+'p', print_cb);
|
||||||
@ -300,6 +300,6 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
return Fl::run();
|
while (!done) Fl::wait();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user