Segmentation fault on resize empty window. #198
vbalyasnyy posted onGitHub
Segmentation fault on next simple code:
int main(void)
{
LCUI_Init();
LCUIDisplay_SetSize(320, 239);
return LCUI_Main();
}
Steps to reproduce the behavior:
- Compile example above.
- Launch it.
Environment:
- LCUI version: 1.3.0
- Build tools: gcc 8.3.0
- OS and version: Ubuntu 18.10
Reason of crash:
in commit https://github.com/lc-soft/LCUI/commit/13c84b2a6a317a79113c6314aca17f2130921b63 used default prototype by default, that have non-empty paint handler pointer (NULL used by default for proto before this fix).
with default protoype for all widgets function src/gui/widget_paint.c:Widget_IsPaintable() returns true.
that is why in render function return non-zero count for empty window, cause src/gui/widget_paint.c:WidgetRenderer() function setup that->can_render_self = Widget_IsPaintable(w) always true.
p.s. but, if use LCUIDisplay_SetSize(321, 241) in example, it is not crashed, couse it updates correctly and creates surface->pixmap and surface->gc and empty widget render successfully