SDLRuby 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9420fbe6427d0cc1c72c97f9da2ff735959cc6233c53df296a2fa75330c5ae8b
4
- data.tar.gz: 7ea49cbccc75f54cc54cc105f8662270b671c182abec10f3bba8ba01868113be
3
+ metadata.gz: 20bdcc86d9ea3a4670b1f0ac86689d0cae12f51417d9ba92cc710be1ecab8614
4
+ data.tar.gz: 3869b91b982b18fe37c5dc97a4b7e99b9f42e2266b42957fa31632ce79bb3447
5
5
  SHA512:
6
- metadata.gz: 59ac04bd9bade02f0865dc35e1977926b907bc535629d412a0c801b7913c10a886641b29cb706e905a8eacac23983dc10971d36009f2daa9d71b0c820e92b880
7
- data.tar.gz: 518572826202fab87596afd4241b87fe743fb3b1055d75d6825a54fe91db9604d965cf074b300941fb84a3f89af47e790c6b9de74c420e352b6af57feabf9824
6
+ metadata.gz: e0c6372d9db1be4ffaa5ff4af4aba575d74d3c36682da3df5423c30fcde44c6986ebcd1b3c8d8e37a909148308922a98436cfba53ad75fcd91d6e84407d275bf
7
+ data.tar.gz: fa71f7889d06990aed6fd43d8bd09573ca6900a7d7223ce513d0a47830610cc95f49a0883854d5d4670ccd7a67ca2e72576cf026298ad6bc94b08e70aecd2e6e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## [0.2.0] - 2023-09-13
4
4
 
5
+ - Memory leak fix on event retrieval failure.
6
+
7
+ ## [0.2.0] - 2023-09-13
8
+
5
9
  - Implementation of the Event Object. SDL event queue is now available.
6
10
 
7
11
  ## [0.1.0] - 2023-08-30
data/lib/SDLRuby/event.rb CHANGED
@@ -6,9 +6,9 @@ module SDLRuby
6
6
  include Accessor, Fiddle, SDL
7
7
 
8
8
  class << self
9
- include SDL
9
+ include Fiddle, SDL
10
10
 
11
- private def __malloc__ = Fiddle.malloc(SDL_Event.size)
11
+ private def __malloc__ = Pointer.malloc(SDL_Event.size, RUBY_FREE)
12
12
 
13
13
  def clear = SDL.SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT)
14
14
 
@@ -43,8 +43,11 @@ module SDLRuby
43
43
  end
44
44
 
45
45
  e = __malloc__
46
- SDL.SDL_WaitEvent(e)
47
- new(e)
46
+ if SDL.SDL_WaitEvent(e) == 1
47
+ new(e)
48
+ else
49
+ raise SDLError
50
+ end
48
51
  end
49
52
 
50
53
  def length = SDL.SDL_PeepEvents(nil, 0, SDL_PEEKEVENT, 0, -1)
@@ -84,15 +87,15 @@ module SDLRuby
84
87
  end
85
88
 
86
89
  def initialize(ptr)
90
+ @ptr = ptr
87
91
  st = SDL_Event.new(ptr)
88
92
  sym = Type[st.type]
89
93
  @entity = st.__send__(sym)
90
- @entity.to_ptr.free = RUBY_FREE
91
94
  extend(Accessor[sym])
92
95
  end
93
96
 
94
97
  private attr_reader :entity
95
98
 
96
- def to_ptr = @entity.to_ptr
99
+ def to_ptr = @ptr
97
100
  end
98
101
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SDLRuby
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SDLRuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - shinokaro