summaryrefslogtreecommitdiff
path: root/src/termio/Thread.zig
diff options
context:
space:
mode:
authorMitchell Hashimoto <mitchell.hashimoto@gmail.com>2022-11-06 16:23:36 -0800
committerMitchell Hashimoto <mitchell.hashimoto@gmail.com>2022-11-06 16:23:36 -0800
commite0db46ac979b384a8e1e16dd586aeb08e8b633de (patch)
tree7fcc4cdd677e344995dea2b47990e2a61034d2a1 /src/termio/Thread.zig
parent05cd77e7cf78f179b991a14b7b975d5f2b88e86e (diff)
clean up some resources better on error
Diffstat (limited to 'src/termio/Thread.zig')
-rw-r--r--src/termio/Thread.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/termio/Thread.zig b/src/termio/Thread.zig
index 2dcfe9476..af175aeab 100644
--- a/src/termio/Thread.zig
+++ b/src/termio/Thread.zig
@@ -49,7 +49,11 @@ pub fn init(
// Create our event loop.
var loop = try libuv.Loop.init(alloc);
- errdefer loop.deinit(alloc);
+ errdefer {
+ // Run the loop once to close any of our handles
+ _ = loop.run(.nowait) catch 0;
+ loop.deinit(alloc);
+ }
loop.setData(allocPtr);
// This async handle is used to "wake up" the renderer and force a render.