diff options
| author | s-ol <s+removethis@s-ol.nu> | 2025-09-22 15:31:11 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-09-22 15:31:11 +0000 |
| commit | 445c01c7862c69e439d8695c63ff2ef0b90c75c4 (patch) | |
| tree | 93b5df50285bec588d520d8456573e114abd8c02 /src | |
| parent | update for Zig 0.15.1 (diff) | |
| download | glsl-view-445c01c7862c69e439d8695c63ff2ef0b90c75c4.tar.gz glsl-view-445c01c7862c69e439d8695c63ff2ef0b90c75c4.zip | |
log errors in threads
Diffstat (limited to 'src')
| -rw-r--r-- | src/gl.zig | 9 | ||||
| -rw-r--r-- | src/tsv.zig | 2 |
2 files changed, 6 insertions, 5 deletions
@@ -902,17 +902,18 @@ pub const Thread = struct { return thread; } - pub const InitFn = fn (*Thread, *const Constants, anytype) anyerror!void; + pub const InitFn = fn (*Thread, *const Constants, anytype) void; fn runner(comptime f: anytype) InitFn { - const ReturnType = @typeInfo(@TypeOf(f)).@"fn".return_type.?; const Impl = struct { - pub fn init(self: *Thread, constants: *const Constants, args: anytype) ReturnType { + pub fn init(self: *Thread, constants: *const Constants, args: anytype) void { c.glfwWindowHint(c.GLFW_VISIBLE, c.GLFW_FALSE); self.window = c.glfwCreateWindow(200, 200, "glsl-view Thread", null, constants.main_window) orelse unreachable; c.glfwMakeContextCurrent(self.window); - return @call(.auto, f, args); + @call(.auto, f, args) catch |err| { + std.debug.print("Error in thread: {}\n", .{err}); + }; } }; diff --git a/src/tsv.zig b/src/tsv.zig index ae052d4..cc6d6d6 100644 --- a/src/tsv.zig +++ b/src/tsv.zig @@ -83,7 +83,7 @@ pub const TSVSource = struct { 2000, 2000, 2000, - ) orelse unreachable; + ) orelse return error.tsvError; const guard = c.gl_client_find_image_data(client, self.name, false) orelse return error.notFound; defer c.gl_client_image_data_guard_destroy(guard); |
