Skip to content

NULL Pointer handled with gx_widget_resize #132

@ryojunne

Description

@ryojunne

Describe the bug
I am using to resize a window what has some child widget(icon,etc) to small size, after I resize again it to large size with gx_widget_resize API, I got a NULL Pointer Handled error.

Image

Please also mention any information which could help others to understand
the problem you're facing:

  • Synergy S5D9
  • SSP 2.6.1 and 2.7.0
  • e2 studio Version: 2025-01 (25.1.0) Build Id: R20241218-1723
  • Toolchain: GNU Tools for ARM Embedded Processors (arm-none-eabi-gcc) 10.3.1.20210824

To Reproduce
Steps to reproduce the behavior:

  1. use gx_widget_resize API to change widget what has some child serval times.
  2. click button1 to mini Mode, button2 to popup and hide, button 1 to Normal Mode, button2 to popup and hide, and loop the same operation.

Expected behavior
resize with gx_widget_resize API with no problem

Impact
CPU reset occur.

Logs and console output

Image

Additional context
no NULL check with the parent just look like at the ★mark.
and with the follow, ■mark with ①②③ will be go wrong.
make a look for the following code please.

PS:I also got a same error in IAR with SSP1.4.0, but in IAR compiler Environment I can not easy to get this error. It need click button fast and continue in a long time(maybe 10min. over). Maybe the different on the Passing Function`s Parameters in IAR. I thought.

gx_widget_resize
_gxe_widget_resize
_gx_widget_resize
_gx_widget_shift

UINT _gx_widget_shift(GX_WIDGET *widget, GX_VALUE x_shift, GX_VALUE y_shift, GX_BOOL mark_dirty)
{
GX_WIDGET *child;

if (x_shift == 0 && y_shift == 0)
{
    return GX_SUCCESS;
}

_gx_widget_shift_helper(widget, x_shift, y_shift, mark_dirty);

/* pick up pointer to first child widget */
child = widget -> gx_widget_first_child;//first child set

/* loop through and shift all my child widgets */

while (child)
{
    _gx_widget_shift_helper(child, x_shift, y_shift, GX_FALSE);//■③then the value of child is dummy data in memory(size info,etc), and something will be go wrong.

    if (child -> gx_widget_first_child)//loop with all first child
    {
        child = child -> gx_widget_first_child;
        continue;
    }
   //after all first child exec
    while ((child -> gx_widget_next == GX_NULL) && (child != widget))
    {
        //★set to child's parnet. but when parnet=NULL then the next step of current loop 
        //will be NULL(0 address)->gx_widget_next.
        child = child -> gx_widget_parent;//■①no NULL check here.
    }

    if (child == widget)
    {
        break;
    }

    child = child -> gx_widget_next;//■②then child will be set to the NULL(0 address)->gx_widget_next.
}

if (mark_dirty && (widget -> gx_widget_status & GX_STATUS_VISIBLE))
{
    _gx_widget_clipping_update(widget);
}

return(GX_SUCCESS);

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Discussion

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions