]> git.openstreetmap.org Git - rails.git/commitdiff
Monkey patch GD2::AnimatedGif to fix the finalizer
authorTom Hughes <tom@compton.nu>
Wed, 14 Aug 2024 17:19:24 +0000 (18:19 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 14 Aug 2024 17:56:03 +0000 (18:56 +0100)
https://github.com/dark-panda/gd2-ffij/pull/27

config/initializers/gd2.rb [new file with mode: 0644]

diff --git a/config/initializers/gd2.rb b/config/initializers/gd2.rb
new file mode 100644 (file)
index 0000000..0005bd8
--- /dev/null
@@ -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)