Mithran

RGSS2 Crash Exposer

Aug 20th, 2012
187
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. b = Cache.character('actor1') # creating a cached bitmap to associate with the sprite
  2. # note: the sprite does not need an associated bitmap to cause the crash
  3. click = RPG::SE.new('cursor', 80, 100) # pre creating the sound effect to denote a completed loop
  4. iterations = 2 # amount of sprites to create per loop (only one will not be disposed)
  5.  
  6. loop {
  7.  
  8. once = false # changing this to true will dispose every sprite and completely prevent the crash
  9. # (large amounts of resources being exchanged will cause some drag eventually, but no crash)
  10. xi = rand(iterations)
  11. iterations.times { |i|
  12. vp = Viewport.new(100, 100, 200, 200)
  13. s = Sprite.new(vp)
  14. s.bitmap = b
  15. s.dispose unless i == xi and !once # 1 / iterations not disposed, random which one, only on first loop
  16. vp.dispose
  17. }
  18.  
  19. once = true # no further sprite disposals will be skipped
  20.  
  21. click.play # removing this line may prevent this instance of the crash (but not always)
  22.  
  23. # Simulating graphical operations of a scene switch - removing these next two lines may also prevent this crash (but not always)
  24. Graphics.freeze
  25. Graphics.transition(20)
  26.  
  27. Graphics.update
  28. Input.update
  29.  
  30. break if Input.press?(Input::C)
  31.  
  32. }
RAW Paste Data