Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset d6c4d40 in mainline


Ignore:
Timestamp:
2021-03-05T11:23:31Z (7 weeks ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
f73a8e3
Parents:
87822ce
git-author:
Jiri Svoboda <jiri@…> (2021-03-04 20:22:52)
git-committer:
Jiri Svoboda <jiri@…> (2021-03-05 11:23:31)
Message:

Do not forget to clean up when exiting

Location:
uspace/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/console.c

    r87822ce rd6c4d40  
    323323void console_unmap(console_ctrl_t *ctrl, charfield_t *buf)
    324324{
     325        async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
     326        (void) async_req_0_0(exch, CONSOLE_UNMAP);
     327        async_exchange_end(exch);
     328
    325329        as_area_destroy(buf);
    326330}
  • uspace/lib/congfx/src/console.c

    r87822ce rd6c4d40  
    137137        sysarg_t rows;
    138138        sysarg_t cols;
    139         charfield_t *buf;
     139        charfield_t *buf = NULL;
    140140        errno_t rc;
    141141
     
    149149        if (rc != EOK)
    150150                goto error;
     151
     152        console_clear(con);
    151153
    152154        rc = console_map(con, cols, rows, &buf);
     
    170172        return EOK;
    171173error:
     174        if (buf != NULL)
     175                console_unmap(cgc->con, buf);
    172176        if (cgc != NULL)
    173177                free(cgc);
     
    187191        if (rc != EOK)
    188192                return rc;
     193
     194        console_clear(cgc->con);
     195        console_unmap(cgc->con, cgc->buf);
    189196
    190197        free(cgc);
  • uspace/lib/ui/private/window.h

    r87822ce rd6c4d40  
    3939
    4040#include <errno.h>
     41#include <congfx/console.h>
    4142#include <display.h>
    4243#include <gfx/context.h>
     
    6061        /** Display window */
    6162        display_window_t *dwindow;
     63        /** Console GC */
     64        console_gc_t *cgc;
    6265        /** Window GC */
    6366        gfx_context_t *gc;
  • uspace/lib/ui/src/window.c

    r87822ce rd6c4d40  
    132132        gfx_bitmap_t *bmp = NULL;
    133133        mem_gc_t *memgc = NULL;
    134         console_gc_t *cgc;
     134        console_gc_t *cgc = NULL;
    135135        errno_t rc;
    136136
     
    256256        window->gc = gc;
    257257#endif
     258        window->cgc = cgc;
     259
    258260        rc = ui_resource_create(window->gc, ui_is_textmode(ui), &res);
    259261        if (rc != EOK)
     
    290292        if (dgc != NULL)
    291293                dummygc_destroy(dgc);
     294        if (cgc != NULL)
     295                console_gc_delete(cgc);
    292296        if (dwindow != NULL)
    293297                display_window_destroy(dwindow);
     
    321325        if (window->dwindow != NULL)
    322326                display_window_destroy(window->dwindow);
     327        if (window->cgc != NULL)
     328                console_gc_delete(window->cgc);
    323329        free(window);
    324330}
Note: See TracChangeset for help on using the changeset viewer.