|
现在有两个屏幕ID,屏A是用ShowCategory185Screen()
屏B是一块白板。
从A到B,然后又从B GoBackHistory();
屏A又会调用ShowCategory185Screen();
但此时发现ShowCategory185Screen(),在绘背景时挂了。
发现是给背景分配图层失败,这个该如何处理啊?
gdi_layer_allocate_buffer() -》dm_redraw_category_screen(void)
-》dm_setup_and_draw_scr_bg(&UICtrlAccessPtr_p) -》
gdi_layer_create(0, 0, UI_device_width, UI_device_height, &g_dm_scr_bg_cntx.layer_handle); -》gdi_layer_allocate_buffer(cf, width, height, &buf_size); -》
static U8 *gdi_layer_allocate_buffer(gdi_color_format cf, S32 width, S32 height, S32 *ret_size)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8* buf_ptr;
S32 i;
S32 size;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
size = gdi_sizeof_pixels(cf, width, height);
/* allcoate buffer from pool, align buffer_size to 4 byte alignment */
size += 3;
size &= ~3;
*ret_size = size;
// try to allocate from pool
buf_ptr = kal_adm_alloc(gdi_layer_buffer_pool_id, size);
// fail, we should free some lazy buffer, and try again
if(buf_ptr == NULL)
{
// iterate all layer, find last allocated position
for (i = 0; i < GDI_LAYER_TOTAL_LAYER_COUNT; i++) // if is used and is lazy and not outside memory
if((GDI_LAYER_FLAG_USED|GDI_LAYER_FLAG_LAZY_FREE) == GDI_LAYER_GET_FLAG(&GDI_LAYERS, GDI_LAYER_FLAG_USED | GDI_LAYER_FLAG_USE_OUTSIDE_MEMORY | GDI_LAYER_FLAG_LAZY_FREE))
{
MMI_TRACE(GDI_TRC, GDI_TRC_26//"-- GDI free lazy layer --"
);
gdi_layer_free((gdi_handle)&GDI_LAYERS);
}
buf_ptr = kal_adm_alloc(gdi_layer_buffer_pool_id, size); // try again
}
GDI_ASSERT(buf_ptr != NULL); // should be enough
return buf_ptr;
}
这里的buf_ptr最终是NULL; |
|