lc-soft/LCUI
The issue has been closed
Segmentation fault on draw window with minimal size. #200
vbalyasnyy posted onGitHub
Segmentation fault on next simple code:
int main(void)
{
LCUI_Widget root;
LCUI_Widget status;
LCUI_Init();
status = LCUIWidget_New("textview");
root = LCUIWidget_GetRoot();
Widget_Append(root, status);
LCUIDisplay_SetSize(320, 239);
return LCUI_Main();
}
Surface creates with minimal (320,240) size settings by default:
static LCUI_Surface X11Surface_New(void)
{
...
surface->width = MIN_WIDTH;
surface->height = MIN_HEIGHT;
...
On surface resize task with size value less than minimal, setups minimal value:
static void X11Surface_RunTask(LCUI_Surface surface, int type)
{
...
w = MIN_WIDTH > w ? MIN_WIDTH : w;
h = MIN_HEIGHT > h ? MIN_HEIGHT : h;
...
But if window size setup in less or equals to minimal value, surfaces struct s->ximages and s->gc do not creates:
static void X11Surface_OnResize(LCUI_Surface s, int width, int height)
{
...
if (width == s->width && height == s->height) {
return;
}
...