Closed silverhammermba closed 11 years ago
This is non-fixable because of what the include method call actually does. It includes the constants and the instance methods of the module into the specified namespace. The graphics? method is a module method or a class method so it will not be included in the new namespace. Why it crashes is a bug in the Ruby Interpreter and something I can't do anything against. It only happens on the main object because it's special cased in the interpreter.
At least this is what I could come up with after writing some more tests on it and actually thinking on what is happening here.
This script causes a Segmentation fault for me.
require 'sfml/graphics' include SFML graphics?
with backtrace:
sfmltest.rb:5: [BUG] Segmentation fault ruby 1.9.3p327 (2012-11-10 revision 37606) [i686-linux]
-- Control frame information ----------------------------------------------- c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :graphics? c:0003 p:0038 s:0006 b:0006 l:00114c d:001eec EVAL sfmltest.rb:5 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH c:0001 p:0000 s:0002 b:0002 l:00114c d:00114c TOP
-- Ruby level backtrace information ---------------------------------------- sfmltest.rb:5:in
<main>' sfmltest.rb:5:in
graphics?'-- C level backtrace information ------------------------------------------- /usr/lib/libruby.so.1.9(+0x15bb63) [0xb76d4b63] /usr/lib/libruby.so.1.9(+0x4dfaf) [0xb75c6faf] /usr/lib/libruby.so.1.9(rb_bug+0x40) [0xb75c7580] /usr/lib/libruby.so.1.9(+0xf6a9c) [0xb766fa9c] linux-gate.so.1(kernel_rt_sigreturn+0) [0xb779a40c] /usr/lib/libruby.so.1.9(+0x132223) [0xb76ab223] /usr/lib/libruby.so.1.9(rb_const_get+0x27) [0xb76ab497] /usr/lib/ruby/site_ruby/1.9.1/i686-linux/sfml/system.so(+0x39c9) [0xb70da9c9] /usr/lib/libruby.so.1.9(+0x146885) [0xb76bf885] /usr/lib/libruby.so.1.9(+0x155877) [0xb76ce877] /usr/lib/libruby.so.1.9(+0x14c44b) [0xb76c544b] /usr/lib/libruby.so.1.9(+0x150a91) [0xb76c9a91] /usr/lib/libruby.so.1.9(rb_iseq_eval_main+0xac) [0xb76d108c] /usr/lib/libruby.so.1.9(+0x5151c) [0xb75ca51c] /usr/lib/libruby.so.1.9(ruby_exec_node+0x24) [0xb75cb054] /usr/lib/libruby.so.1.9(ruby_run_node+0x36) [0xb75cca66] ruby() [0x80486b8] /usr/lib/libc.so.6(libc_start_main+0xf5) [0xb73e8605] ruby() [0x80486e1]
If I call
SFML.graphics?
without theinclude
, it works just fine.