Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault on draw window with minimal size. #200

Closed
vbalyasnyy opened this issue Mar 12, 2020 · 0 comments · Fixed by #201
Closed

Segmentation fault on draw window with minimal size. #200

vbalyasnyy opened this issue Mar 12, 2020 · 0 comments · Fixed by #201

Comments

@vbalyasnyy
Copy link
Contributor

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;
    }
...
vbalyasnyy pushed a commit to vbalyasnyy/LCUI that referenced this issue Mar 12, 2020
lc-soft pushed a commit that referenced this issue Mar 13, 2020
#201)

Signed-off-by: Vasilyy Balyasnyy <[email protected]>

Co-authored-by: Vasilyy Balyasnyy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant