From 390d49d3f0e1e38949ea02a0a92c21d2184e72e1 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 14 Aug 2024 18:19:24 +0100 Subject: [PATCH] Monkey patch GD2::AnimatedGif to fix the finalizer https://github.com/dark-panda/gd2-ffij/pull/27 --- config/initializers/gd2.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 config/initializers/gd2.rb diff --git a/config/initializers/gd2.rb b/config/initializers/gd2.rb new file mode 100644 index 0000000000..0005bd8be9 --- /dev/null +++ b/config/initializers/gd2.rb @@ -0,0 +1,15 @@ +module OpenStreetMap + module GD2 + module AnimatedGif + def frames_finalizer + proc do + @frames.each do |frame| + ::GD2::GD2FFI.send(:gdFree, frame.ptr) + end + end + end + end + end +end + +GD2::AnimatedGif.prepend(OpenStreetMap::GD2::AnimatedGif)