提交 b324e1a2 编写于 作者: B bernard.xiong@gmail.com

fix view and workbench destroy issue.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@944 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 bddae69d
...@@ -64,6 +64,7 @@ rtgui_type_t* rtgui_workbench_type_get(void); ...@@ -64,6 +64,7 @@ rtgui_type_t* rtgui_workbench_type_get(void);
rtgui_workbench_t *rtgui_workbench_create(const char* panel_name, const unsigned char* title); rtgui_workbench_t *rtgui_workbench_create(const char* panel_name, const unsigned char* title);
void rtgui_workbench_destroy(rtgui_workbench_t* workbench); void rtgui_workbench_destroy(rtgui_workbench_t* workbench);
void rtgui_workbench_close(rtgui_workbench_t* workbench);
rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* event); rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* event);
......
...@@ -135,6 +135,20 @@ void rtgui_workbench_destroy(rtgui_workbench_t* workbench) ...@@ -135,6 +135,20 @@ void rtgui_workbench_destroy(rtgui_workbench_t* workbench)
{ {
RT_ASSERT(workbench != RT_NULL); 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) if (RTGUI_TOPLEVEL(workbench)->server != RT_NULL)
{ {
struct rtgui_event_panel_detach edetach; struct rtgui_event_panel_detach edetach;
...@@ -151,7 +165,8 @@ void rtgui_workbench_destroy(rtgui_workbench_t* workbench) ...@@ -151,7 +165,8 @@ void rtgui_workbench_destroy(rtgui_workbench_t* workbench)
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) void rtgui_workbench_set_flag(rtgui_workbench_t* workbench, rt_uint8_t flag)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册