| 
      
      
      From: Kevin S. <kev...@ya...> - 2001-09-01 01:08:47
      
     | 
| This little program gets a segfault when I exit:
###
require 'fltk'
Fltk::FLWindow.new(0, 0, 400, 200, 'Hello Ruby-FLTK!').show
Fltk::run
###
I wonder if it might be because FLTK doesn't make a copy of
the label string? In my prototype, I coded for this (even
though I didn't actually see a problem). Here's my label()
method in the C++ class that wrapped each FLTK class:
void label(const char* p) { \
   const char* pOld = Fl_##klass::label(); \
   free((char*)pOld); \
   char* pNew = strdup(p); \
   Fl_##klass::label(pNew);} \
   const char* label() { printf("Getting\n"); \
   return Fl_##klass::label();} \
I never passed a label to the actual FLTK widget
constructor. I would always call label() after the actual
construction, so it would go through this code.
You know more about Ruby memory management, so I don't want
to make a change like this myself yet.
I don't know why your window.rb sample works fine.
Kevin
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com
 |