From 124c90b1668d81973d2fee81f8257964f2b56aff Mon Sep 17 00:00:00 2001
From: Seth Axen <seth@sethaxen.com>
Date: Mon, 11 Nov 2024 10:01:02 +0100
Subject: [PATCH] Make sure event loop is terminated when Julia exists

---
 src/init.jl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/init.jl b/src/init.jl
index 4cc0ad9..f77cdf0 100644
--- a/src/init.jl
+++ b/src/init.jl
@@ -178,6 +178,9 @@ function __init__()
     end
 
     init_colormaps()
+
+    # Ensure that the event loop is stopped when the Julia process exits
+    atexit(pygui_stop_all)
 end
 
 function pygui(b::Bool)