mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-25 06:59:46 -05:00
Better handling of creation errors in display.
This commit is contained in:
parent
c9a729260f
commit
fcd4caa0df
2 changed files with 7 additions and 1 deletions
|
|
@ -373,6 +373,11 @@ wl_display_connect(const char *name)
|
|||
}
|
||||
|
||||
display->objects = wl_hash_table_create();
|
||||
if (display->objects == NULL) {
|
||||
close(display->fd);
|
||||
free(display);
|
||||
return NULL;
|
||||
}
|
||||
wl_list_init(&display->global_listener_list);
|
||||
|
||||
display->proxy.object.interface = &wl_display_interface;
|
||||
|
|
@ -397,6 +402,7 @@ WL_EXPORT void
|
|||
wl_display_destroy(struct wl_display *display)
|
||||
{
|
||||
wl_connection_destroy(display->connection);
|
||||
wl_hash_table_destroy(display->objects);
|
||||
close(display->fd);
|
||||
free(display);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -544,8 +544,8 @@ wl_display_create(void)
|
|||
display->object.implementation = (void (**)(void)) &display_interface;
|
||||
wl_display_add_object(display, &display->object);
|
||||
if (wl_display_add_global(display, &display->object, NULL)) {
|
||||
wl_event_loop_destroy(display->loop);
|
||||
wl_hash_table_destroy(display->objects);
|
||||
wl_event_loop_destroy(display->loop);
|
||||
free(display);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue