diff options
| author | Tom Black <[email protected]> | 2015-10-07 00:33:16 -0400 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2015-10-07 00:33:16 -0400 |
| commit | bbbe83a3a2a9071ea48d0e25a4638fee5cb3ea30 (patch) | |
| tree | 9b0ed2ae76814ce7399f2e9e8455d4bf0b3de60c /ext | |
| parent | a806fa7ec1e66a23bdda5cde7075830095740fa8 (diff) | |
| download | ruby2d-bbbe83a3a2a9071ea48d0e25a4638fee5cb3ea30.tar.gz ruby2d-bbbe83a3a2a9071ea48d0e25a4638fee5cb3ea30.zip | |
Fixing window hang
Window and media subsystems were being closed too early after `show`,
causing Ruby garbage collection to hang when freeing objects relying on
those systems.
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/ruby2d/ruby2d.c | 4 |
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; } |
