Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- b = Cache.character('actor1') # creating a cached bitmap to associate with the sprite
- # note: the sprite does not need an associated bitmap to cause the crash
- click = RPG::SE.new('cursor', 80, 100) # pre creating the sound effect to denote a completed loop
- iterations = 2 # amount of sprites to create per loop (only one will not be disposed)
- loop {
- once = false # changing this to true will dispose every sprite and completely prevent the crash
- # (large amounts of resources being exchanged will cause some drag eventually, but no crash)
- xi = rand(iterations)
- iterations.times { |i|
- vp = Viewport.new(100, 100, 200, 200)
- s = Sprite.new(vp)
- s.bitmap = b
- s.dispose unless i == xi and !once # 1 / iterations not disposed, random which one, only on first loop
- vp.dispose
- }
- once = true # no further sprite disposals will be skipped
- click.play # removing this line may prevent this instance of the crash (but not always)
- # Simulating graphical operations of a scene switch - removing these next two lines may also prevent this crash (but not always)
- Graphics.freeze
- Graphics.transition(20)
- Graphics.update
- Input.update
- break if Input.press?(Input::C)
- }
Advertisement
Add Comment
Please, Sign In to add comment