diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2010-09-27 11:29:05 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2010-09-27 11:29:05 +0000 |
| commit | 5c968a2589f3a32a01d17db0130ead4e778fbd80 (patch) | |
| tree | deeec9f51d271f156a02822c58e5a4dab0e96c73 /src/fl_ask.cxx | |
| parent | 280720df7cc93bcb181026e57ac1187666c5e6ce (diff) | |
Fixed undefined behavior of fl_choice and others when closing
the message window instead of using a button (STR 2418).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7705 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_ask.cxx')
| -rw-r--r-- | src/fl_ask.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx index 791f7a173..b8b45efb2 100644 --- a/src/fl_ask.cxx +++ b/src/fl_ask.cxx @@ -65,8 +65,13 @@ Fl_Fontsize fl_message_size_ = 14; static char avoidRecursion = 0; -// sets the global return value (ret_val) and closes the window -static void button_cb(Fl_Widget *bt, void *val) { +// Sets the global return value (ret_val) and closes the window. +// Note: this is used for the button callbacks and the window +// callback (closing the window with the close button or menu). +// The first argument (Fl_Widget *) can either be an Fl_Button* +// pointer to one of the buttons or an Fl_Window* pointer to the +// message window (message_form). +static void button_cb(Fl_Widget *, void *val) { ret_val = (int)(long)val; message_form->hide(); } @@ -82,6 +87,7 @@ static Fl_Window *makeform() { Fl_Group::current(0); // create a new top level window Fl_Window *w = message_form = new Fl_Window(410,103,""); + message_form->callback(button_cb,(void *)0); // w->clear_border(); // w->box(FL_UP_BOX); (message = new Fl_Box(60, 25, 340, 20)) |
