VincentWei / MiniGUI

A modern and mature cross-platform window system for embedded systems and smart IoT devices.
http://www.minigui.com
GNU General Public License v3.0
695 stars 157 forks source link

5.0.8/newgdi/gdi.c中函数InitSubDC的问题 #81

Closed DaVinci79 closed 2 years ago

DaVinci79 commented 2 years ago

看了5.0.8代码,newgdi/gdi.c中dc_InitClipRgnInfo函数是空,去掉对DCSlot的lcrgn和ecrgn的初始化,这可能会导致InitSubDC调用CopyRegion时,由于lcrgn和ecrgn的heap为NULL,引起段错。 mgncs4touch\samples下例程settingtableview.c、tableview.c和hscrollview.c这三个例子就会出现段错,因为采用ncsCreateMainWindow创建主窗口的。 测试环境ubuntu20.04 LTS

VincentWei commented 2 years ago

Thanks for your bug report!

VincentWei commented 2 years ago

I have fixed the bug: call InitClipRgn before calling CopyRegion:

    InitClipRgn (&pdc->lcrgn, &__mg_FreeClipRectList);
    MAKE_REGION_INFINITE(&pdc->lcrgn);
    InitClipRgn (&pdc->ecrgn, &__mg_FreeClipRectList);