| 
      
      
      From: Kent D. <ke...@st...> - 2001-11-27 07:44:06
      
     | 
| Takaaki Tateishi wrote:
> Though I also tried, (*2) didn't crash and (*3) crashed.
> I think b must be destroied when calling Fl::run(), but
> Ruby/FLTK treats it as alive widget.
> I've fixed this problem. Would you try again?
I may have mixed up the w and b in the example, as I was trying many
permutations.
Sorry about that. Here is the new test code I am using.
<CODE>
require 'rubyfltk.so'
w = Fltk::Window.new(0,0,200,200)
b = Fltk::Button.new(0,0,20,20,"X"){|a,b|
  #w.hide
  puts "hidden"
  Fltk.paste(w)  #(*1)
  puts "done"
}
#Fltk.paste( nil )  #(*2)
#Fltk.paste( w )    #(*3)
w.show
Fltk.paste( w )     #(*4)
Fltk.run
Fltk.paste( w )     #(*5)
</CODE>
*2 and *3 still seg-fault. 
*2 is because rb_to_fl returns NULL if VALUE is Qnil, which I don't
think Fl::paste likes.
*3 is the main problem I worry about. It seems that w.show in turn
initializes something that allows events to be sent. I tried to call
b.show and then Fltk.paste(b), but that still segfaults. So I still
suspect some FLTK wide initialization code, which may be that
Fl::check() is responcible to... uhm, check?
(I removed my code and cvs updated when I tried this.)
-- 
<[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]>
  )____(stud.techn.;ind.øk.data)||(softwareDeveloper.at(Trustix))_( 
 /"Opinions expressed are mine and not those of my Employer,      "\
( "the University, my girlfriend, stray cats, banana fruitflies,  " )
 \"nor the frontal lobe of my left cerebral hemisphere.           "/
 |