libgnt/libgnt

bd85338d3a9d
Parents 31662f6b9346
Children 6257c6712eaf
Fix invalid reads/writes when hiding widget in Finch

Fix invalid reads/writes when hiding widget in Finch

Testing Done:
ran "steps to reproduce" from LIBGNT-13 without getting invalid reads/writes anymore.

Bugs closed: LIBGNT-13

Reviewed at https://reviews.imfreedom.org/r/810/
  • +4 -2
    gntwidget.c
  • --- a/gntwidget.c Mon Jul 12 00:54:36 2021 -0500
    +++ b/gntwidget.c Thu Jul 15 01:02:07 2021 -0500
    @@ -328,7 +328,7 @@
    if (!gnt_widget_in_destruction(obj)) {
    GNT_WIDGET_SET_FLAGS(obj, GNT_WIDGET_DESTROYING);
    gnt_widget_hide(obj);
    - delwin(obj->window);
    + g_clear_pointer(&obj->window, delwin);
    g_object_run_dispose(G_OBJECT(obj));
    }
    GNTDEBUG;
    @@ -442,7 +442,9 @@
    gnt_widget_hide(GntWidget *widget)
    {
    g_signal_emit(widget, signals[SIG_HIDE], 0);
    - wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
    + if (widget->window) {
    + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
    + }
    #if 0
    /* XXX: I have no clue why, but this seemed to be necessary. */
    if (gnt_widget_has_shadow(widget))