diff options
| author | [email protected] <[email protected]> | 2010-09-24 11:30:54 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2010-09-24 11:30:54 +0000 |
| commit | b324e1a2d218dd85a87e9f3266f0891f058bef78 (patch) | |
| tree | 9fd79ec64c1bb71910c716057c7b7bff5141476e /components/rtgui/widgets | |
| parent | bddae69d9c2e2b980cdeb6e1195517a6e8bee73a (diff) | |
fix view and workbench destroy issue.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@944 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/widgets')
| -rw-r--r-- | components/rtgui/widgets/workbench.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/components/rtgui/widgets/workbench.c b/components/rtgui/widgets/workbench.c index fd203f91e0..1ccc177453 100644 --- a/components/rtgui/widgets/workbench.c +++ b/components/rtgui/widgets/workbench.c @@ -135,6 +135,20 @@ void rtgui_workbench_destroy(rtgui_workbench_t* workbench) { RT_ASSERT(workbench != RT_NULL); + if (workbench->flag & RTGUI_WORKBENCH_FLAG_CLOSED) + { + rtgui_widget_destroy(RTGUI_WIDGET(workbench)); + } + else + { + /* just close workbench */ + rtgui_workbench_close(workbench); + } +} + +void rtgui_workbench_close(rtgui_workbench_t* workbench) +{ + /* detach workbench in server */ if (RTGUI_TOPLEVEL(workbench)->server != RT_NULL) { struct rtgui_event_panel_detach edetach; @@ -148,10 +162,11 @@ void rtgui_workbench_destroy(rtgui_workbench_t* workbench) RTGUI_EVENT(&edetach), sizeof(struct rtgui_event_panel_detach)) != RT_EOK) return; - RTGUI_TOPLEVEL(workbench)->server = RT_NULL; + RTGUI_TOPLEVEL(workbench)->server = RT_NULL; } - rtgui_widget_destroy(RTGUI_WIDGET(workbench)); + /* set status to close */ + workbench->flag |= RTGUI_WORKBENCH_FLAG_CLOSED; } void rtgui_workbench_set_flag(rtgui_workbench_t* workbench, rt_uint8_t flag) |
