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

Changeset da412547 in mainline


Ignore:
Timestamp:
2019-11-10T17:07:44Z (16 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
b093a62
Parents:
6427f083
Message:

Display server should deal with client not destroying windows properly

Location:
uspace/srv/hid/display
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/client.c

    r6427f083 rda412547  
    7575void ds_client_destroy(ds_client_t *client)
    7676{
     77        ds_window_t *window;
     78
     79        window = ds_client_first_window(client);
     80        while (window != NULL) {
     81                ds_window_destroy(window);
     82                window = ds_client_first_window(client);
     83        }
     84
    7785        assert(list_empty(&client->windows));
    7886        ds_display_remove_client(client);
  • uspace/srv/hid/display/test/client.c

    r6427f083 rda412547  
    203203}
    204204
     205/** Test client being destroyed while still having a window.
     206 *
     207 * This can happen if client forgets to destroy window or if the client
     208 * is disconnected (or terminated).
     209 */
     210PCUT_TEST(client_leftover_window)
     211{
     212        ds_display_t *disp;
     213        ds_client_t *client;
     214        ds_window_t *wnd;
     215        errno_t rc;
     216
     217        rc = ds_display_create(NULL, &disp);
     218        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     219
     220        rc = ds_client_create(disp, NULL, NULL, &client);
     221        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     222
     223        rc = ds_window_create(client, &wnd);
     224        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     225
     226        ds_client_destroy(client);
     227        ds_display_destroy(disp);
     228}
     229
    205230PCUT_EXPORT(client);
  • uspace/srv/hid/display/window.c

    r6427f083 rda412547  
    220220 * @param wnd Window GC
    221221 */
    222 errno_t ds_window_destroy(ds_window_t *wnd)
    223 {
    224         errno_t rc;
    225 
     222void ds_window_destroy(ds_window_t *wnd)
     223{
    226224        ds_client_remove_window(wnd);
    227 
    228         rc = gfx_context_delete(wnd->gc);
    229         if (rc != EOK)
    230                 return rc;
     225        (void) gfx_context_delete(wnd->gc);
    231226
    232227        free(wnd);
    233         return EOK;
    234228}
    235229
  • uspace/srv/hid/display/window.h

    r6427f083 rda412547  
    4747
    4848extern errno_t ds_window_create(ds_client_t *, ds_window_t **);
    49 extern errno_t ds_window_destroy(ds_window_t *);
     49extern void ds_window_destroy(ds_window_t *);
    5050extern gfx_context_t *ds_window_get_ctx(ds_window_t *);
    5151
Note: See TracChangeset for help on using the changeset viewer.