diff --git a/components/rtgui/server/server.c b/components/rtgui/server/server.c index 4b143438fc04a3f084d168758f1b06b240340f05..65f5d6b321a0d01a4b6491e31b601a4fa6da88fb 100644 --- a/components/rtgui/server/server.c +++ b/components/rtgui/server/server.c @@ -136,7 +136,6 @@ void rtgui_server_thread_panel_hide(struct rtgui_event_panel_hide* event) if (panel != RT_NULL) { rt_thread_t tid; - struct rtgui_event_paint epaint; /* send the responses */ rtgui_thread_ack(RTGUI_EVENT(event), RTGUI_STATUS_OK); @@ -153,15 +152,20 @@ void rtgui_server_thread_panel_hide(struct rtgui_event_panel_hide* event) rtgui_list_append(&(panel->thread_list), &(thread->list)); } - /* get new active thread */ - tid = rtgui_panel_get_active_thread(panel); /* send all topwin clip info */ rtgui_topwin_update_clip_to_panel(panel); - /* send paint event */ - RTGUI_EVENT_PAINT_INIT(&epaint); - epaint.wid = RT_NULL; - rtgui_thread_send(tid, (struct rtgui_event*)&epaint, sizeof(epaint)); + /* get new active thread */ + tid = rtgui_panel_get_active_thread(panel); + if (tid != RT_NULL) + { + struct rtgui_event_paint epaint; + + /* send paint event */ + RTGUI_EVENT_PAINT_INIT(&epaint); + epaint.wid = RT_NULL; + rtgui_thread_send(tid, (struct rtgui_event*)&epaint, sizeof(epaint)); + } } else { diff --git a/components/rtgui/widgets/workbench.c b/components/rtgui/widgets/workbench.c index c3409db584ab8c79a563c67e1bede0c85f6731ea..fd203f91e0739790190464d72e2f3ec215b9e319 100644 --- a/components/rtgui/widgets/workbench.c +++ b/components/rtgui/widgets/workbench.c @@ -135,9 +135,6 @@ 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; @@ -398,6 +395,9 @@ rt_bool_t rtgui_workbench_event_handler(rtgui_widget_t* widget, rtgui_event_t* e { rtgui_view_t* view; + /* un-hide workbench */ + RTGUI_WIDGET_UNHIDE(widget); + /* paint a view */ view = workbench->current_view; if (view != RT_NULL)