[#3228] Core support for Gems, and namespace — "Luke A. Kanies" <luke@...>

Hi all,

21 messages 2004/07/27
[#3230] Re: Core support for Gems, and namespace — Austin Ziegler <halostatue@...> 2004/07/27

On Tue, 27 Jul 2004 11:39:08 +0900, Luke A. Kanies <luke@madstop.com> wrote:

[#3234] Re: Core support for Gems, and namespace — "Luke A. Kanies" <luke@...> 2004/07/27

On Tue, 27 Jul 2004, Austin Ziegler wrote:

[#3238] Re: Core support for Gems, and namespace — Austin Ziegler <halostatue@...> 2004/07/27

On Wed, 28 Jul 2004 00:14:29 +0900, Luke A. Kanies <luke@madstop.com> wrote:

[Bug] Ruby 1.8.1 and 1.9: interactions between extensions: opengl and imlib2

From: Alvin Schur <schur@...>
Date: 2004-07-14 03:39:13 UTC
List: ruby-core #3189
Hi,

I am trying to use the opengl and imlib2 extensions with Ruby 1.8.1 and 1.9.  
The program listed below causes a segfault in both versions of Ruby.  The 
backtrace at the end of the email is for Ruby 1.9.  The interesting lines 
are:

def init_timer_fails
  GLUT.TimerFunc(100, handle_timer, 34)
end

init_timer_fails
image_data_large = image.data

The segfault occurs with this combination.  If the "image_data_large" line is 
commented out, the program works.  If the "GLUT.TimerFunc" is initialized 
differently (see source), the program works.

Did I do something to cause the poor interaction between Ruby extensions?

Thanks,

Alvin


ruby 1.8.1 and 1.9 (cvs on July 13)
opengl-0.32d
    http://www2.giganet.net/~yoshi/
Imlib2-Ruby 0.4.2
    http://www.pablotron.org/software/imlib2-ruby/



require 'glut'
require 'imlib2'


def handle_timer
  proc { |value| puts "handle timer #{value}" }
end

def init_timer_works
  timer = handle_timer
  GLUT.TimerFunc(100, timer, 34)
end

def init_timer_fails
  GLUT.TimerFunc(100, handle_timer, 34)
end


if __FILE__ == $0
  puts "Starting test"

  GLUT.Init
  window = GLUT.CreateWindow("WINDOW_TITLE")

  init_timer_fails
#  init_timer_works

# Initializing timer here works
#  GLUT.TimerFunc(100, handle_timer, 37)
#  timer = handle_timer
#  GLUT.TimerFunc(100, timer, 37)

  image = Imlib2::Image.load("data/mtm-05287e_dem.tif")
  image_data_large = image.data
  
  GLUT.MainLoop()
end





(gdb) run lib/game-1_9.rb
Starting program: /mnt/hda5/home/schur/test_cvs/bin/ruby lib/game-1_9.rb
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 9232)]
Starting test
Xlib:  extension "XFree86-DRI" missing on display ":0.0".

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 9232)]
0x080b1884 in st_lookup (table=0x8137c30, key=5233, value=0xbfffef78)
    at st.c:258
258         hash_val = do_hash(key, table);
(gdb) backtrace
#0  0x080b1884 in st_lookup (table=0x8137c30, key=5233, value=0xbfffef78)
    at st.c:258
#1  0x080540b3 in search_method (klass=1075599996, id=5233, origin=0xbfffefa4)
    at eval.c:380
#2  0x08054109 in rb_get_method_body (klassp=0xbffff000, idp=0xbfffefe4, 
    noexp=0xbfffefe8) at eval.c:401
#3  0x0805e5aa in rb_call (klass=1075599996, recv=1075600016, mid=5233, 
    argc=1, argv=0xbffff018, scope=1) at eval.c:5720
#4  0x0805e9d4 in rb_funcall (recv=1075600016, mid=1635017060, n=1)
    at ruby.h:634
#5  0x4001d92d in glut_TimerFuncCallback (value=1635017060) at glut.c:712
#6  0x401fee6c in fgJoystickPollWindow () from /usr/lib/libglut.so.3
#7  0x401ffb7b in glutMainLoopEvent () from /usr/lib/libglut.so.3
#8  0x401ffbf5 in glutMainLoop () from /usr/lib/libglut.so.3
#9  0x4001ad29 in glut_MainLoop (obj=1075627116) at glut.c:141
#10 0x0806a1d1 in call_cfunc (func=0x4001ad10 <glut_MainLoop>, 
    recv=1075627116, len=135494704, argc=135283568, argv=0x0) at eval.c:5396
#11 0x0805e428 in rb_call0 (klass=1075627016, recv=1075627116, id=10357, 
    oid=1635017060, argc=0, argv=0x0, body=0x401cc264, nosuper=0)
    at eval.c:5527
#12 0x0805e658 in rb_call (klass=1075627016, recv=1075627116, mid=10357, 
    argc=0, argv=0x0, scope=0) at eval.c:5744
#13 0x080593eb in rb_eval (self=1075694016, n=0x61746164) at ruby.h:634
---Type <return> to continue, or q <return> to quit---
#14 0x0805586b in ruby_exec () at eval.c:1462
#15 0x080558b0 in ruby_run () at eval.c:1483
#16 0x08053985 in main (argc=1635017060, argv=0x61746164, envp=0xbffffbd0)
    at main.c:38

In This Thread

Prev Next