Handle destruction of Server properly

This commit is contained in:
Isaac Freund 2020-03-24 21:18:17 +01:00
parent aaecef8c5c
commit a3eb33a7b1
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
2 changed files with 2 additions and 2 deletions

View file

@ -9,9 +9,9 @@ pub fn main() !void {
c.wlr_log_init(c.enum_wlr_log_importance.WLR_DEBUG, null);
var server = try Server.create(std.heap.c_allocator);
defer server.destroy();
try server.init();
defer server.deinit();
try server.start();

View file

@ -91,7 +91,7 @@ pub const Server = struct {
}
/// Free allocated memory and clean up
pub fn deinit(self: Self) void {
pub fn destroy(self: Self) void {
c.wl_display_destroy_clients(self.wl_display);
c.wl_display_destroy(self.wl_display);
c.wlr_output_layout_destroy(self.wlr_output_layout);