summaryrefslogtreecommitdiffhomepage
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/ruby2d/ruby2d.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/ruby2d/ruby2d.c b/ext/ruby2d/ruby2d.c
index 1c4442a..625215a 100644
--- a/ext/ruby2d/ruby2d.c
+++ b/ext/ruby2d/ruby2d.c
@@ -26,6 +26,9 @@ struct sound_data {
Sound snd;
};
+static void close_window() {
+ S2D_Close(window);
+}
static void free_image(struct image_data *data) {
S2D_FreeImage(data->img);
@@ -212,6 +215,7 @@ static VALUE ruby2d_show(VALUE s) {
S2D_Show(window);
+ atexit(close_window);
return Qnil;
}