From c217605befa4f89c24b5fcc168289b963489e9d5 Mon Sep 17 00:00:00 2001 From: "bernard.xiong@gmail.com" Date: Fri, 24 Sep 2010 04:31:20 +0000 Subject: [PATCH] fix view and workbench destroy issue. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@941 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/rtgui/common/font_hz_bmp.c | 2 +- components/rtgui/common/font_hz_file.c | 2 +- components/rtgui/widgets/view.c | 4 ++++ components/rtgui/widgets/workbench.c | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/components/rtgui/common/font_hz_bmp.c b/components/rtgui/common/font_hz_bmp.c index 5e025e0b78..17f5ed106d 100644 --- a/components/rtgui/common/font_hz_bmp.c +++ b/components/rtgui/common/font_hz_bmp.c @@ -6,7 +6,7 @@ static void rtgui_hz_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect); static void rtgui_hz_bitmap_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect); -struct rtgui_font_engine hz_bmp_font_engine = +const struct rtgui_font_engine hz_bmp_font_engine = { RT_NULL, RT_NULL, diff --git a/components/rtgui/common/font_hz_file.c b/components/rtgui/common/font_hz_file.c index 03b41f02a1..d8859abf85 100644 --- a/components/rtgui/common/font_hz_file.c +++ b/components/rtgui/common/font_hz_file.c @@ -15,7 +15,7 @@ static int _font_cache_compare(struct hz_cache* node1, struct hz_cache* node2); static void rtgui_hz_file_font_load(struct rtgui_font* font); static void rtgui_hz_file_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect); static void rtgui_hz_file_font_get_metrics(struct rtgui_font* font, const char* text, rtgui_rect_t* rect); -struct rtgui_font_engine rtgui_hz_file_font_engine = +const struct rtgui_font_engine rtgui_hz_file_font_engine = { RT_NULL, rtgui_hz_file_font_load, diff --git a/components/rtgui/widgets/view.c b/components/rtgui/widgets/view.c index 4a7dfe12e6..ec8f12cd1b 100644 --- a/components/rtgui/widgets/view.c +++ b/components/rtgui/widgets/view.c @@ -10,6 +10,7 @@ * Change Logs: * Date Author Notes * 2009-10-16 Bernard first version + * 2010-09-24 Bernard fix view destroy issue */ #include #include @@ -119,7 +120,10 @@ void rtgui_view_destroy(rtgui_view_t* view) if (view->modal_show == RT_TRUE) rtgui_view_end_modal(view, RTGUI_MODAL_CANCEL); else + { + rtgui_view_hide(view); rtgui_widget_destroy(RTGUI_WIDGET(view)); + } } #ifndef RTGUI_USING_SMALL_SIZE diff --git a/components/rtgui/widgets/workbench.c b/components/rtgui/widgets/workbench.c index 1cfc98eedc..c3409db584 100644 --- a/components/rtgui/widgets/workbench.c +++ b/components/rtgui/widgets/workbench.c @@ -10,6 +10,7 @@ * Change Logs: * Date Author Notes * 2009-10-04 Bernard first version + * 2010-09-24 Bernard fix workbench destroy issue */ #include #include @@ -134,6 +135,9 @@ void rtgui_workbench_destroy(rtgui_workbench_t* workbench) { RT_ASSERT(workbench != RT_NULL); + /* hide workbench firstly */ + rtgui_workbench_hide(workbench); + if (RTGUI_TOPLEVEL(workbench)->server != RT_NULL) { struct rtgui_event_panel_detach edetach;