瀏覽代碼

fix view and workbench destroy issue.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@941 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong@gmail.com 14 年之前
父節點
當前提交
c217605bef

+ 1 - 1
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,

+ 1 - 1
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,

+ 4 - 0
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 <rtgui/dc.h>
 #include <rtgui/rtgui_system.h>
@@ -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

+ 4 - 0
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 <rtgui/rtgui_system.h>
 #include <rtgui/widgets/window.h>
@@ -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;