diff options
author | jcid <devnull@localhost> | 2008-10-03 19:08:35 +0200 |
---|---|---|
committer | jcid <devnull@localhost> | 2008-10-03 19:08:35 +0200 |
commit | 79e103eb107e90a9ef862561b6e36f35ed7b92d8 (patch) | |
tree | 91c8eec95a9efa8d2738e14653294fd1608c1d47 /src/ui.cc | |
parent | c8054c09d4652a435089f5ec042b9a33bcbe12d9 (diff) |
- Set menubar "close window" items from a timeout
(to avoid events on deleted widgets)
Diffstat (limited to 'src/ui.cc')
-rw-r--r-- | src/ui.cc | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -27,6 +27,7 @@ #include "ui.hh" #include "msg.h" +#include "timeout.hh" using namespace fltk; @@ -469,6 +470,20 @@ PackedGroup *UI::make_progress_bars(int wide, int thin_up) } /* + * Close bw's behind a timeout to let the triggering code unwind out of the + * window before it's all torn down. + */ +static void menubar_close_bw(void *vbw) +{ + BrowserWindow *bw = (BrowserWindow *)vbw; + if (bw) + a_UIcmd_close_bw(bw); + else + a_UIcmd_close_all_bw(); + a_Timeout_remove(); +} + +/* * Static function for menubar callbacks. */ static void menubar_cb(Widget *wid, void *data) @@ -483,9 +498,9 @@ static void menubar_cb(Widget *wid, void *data) } else if (strcmp((char*)data, "ou") == 0) { a_UIcmd_focus_location(a_UIcmd_get_bw_by_widget(wid)); } else if (strcmp((char*)data, "cw") == 0) { - a_UIcmd_close_bw(a_UIcmd_get_bw_by_widget(wid)); + a_Timeout_add(0.0, menubar_close_bw, a_UIcmd_get_bw_by_widget(wid)); } else if (strcmp((char*)data, "ed") == 0) { - a_UIcmd_close_all_bw(); + a_Timeout_add(0.0, menubar_close_bw, NULL); } } |