I’m getting a segfault after doing some stuff within my FXRuby app, then switching focus to a
different window and moving the new window around. My initial guess is that it has something to
do with send a PAINT message when the window is not in focus. However, this ONLY happens after
doing some fairly intensive work within the app. I know this is vague… and if necessary, I’ll
pare down my code and try to isolate it.
I’m using Ruby v1.6.8 and FXRuby v1.0.18. Both are the pre-packaged windows self-installers.
Herte is the exact error message :
EraGUI.rb:624: [BUG] Segmentation fault
ruby 1.6.8 (2002-12-24) [i586-mswin32]
abnormal program termination
Line 624 of my app is :
623: theApp.create
624: theWindow.setupWidgets #this is a method I use to do the set up of all the widgets
625: theApp.run
Any ideas before I work to pare the code down?
Jason
Jason Persampieri wrote:
Any ideas before I work to pare the code down?
Do GC.disable and try to recreate the segfault. It might be a problem
with some of the mark/free routines in FXRuby.
Jason Persampieri wrote:
I’m getting a segfault after doing some stuff within my FXRuby app, then switching focus to a
different window and moving the new window around. My initial guess is that it has something to
do with send a PAINT message when the window is not in focus. However, this ONLY happens after
doing some fairly intensive work within the app. I know this is vague… and if necessary, I’ll
pare down my code and try to isolate it.
I see that Joel has already responded and you may have a workaround; but
if you could, please send me some code to reproduce the problem. There
wasn’t anything particularly wrong-looking about the code snippet that
you showed (about setting a new font into a group box), and it should
not have caused the program to crash.
Hmm… that seems to work. I guess it’s possible that disabling garbage-collection simply hid the
problem. Is there a way to log garbage collection? I could see what’s going on in the crash
scenario.
Jason
···
— Joel VanderWerf vjoel@PATH.Berkeley.EDU wrote:
Jason Persampieri wrote:
Any ideas before I work to pare the code down?
Do GC.disable and try to recreate the segfault. It might be a problem
with some of the mark/free routines in FXRuby.
I see that Joel has already responded and you may have a workaround; but
if you could, please send me some code to reproduce the problem. There
wasn’t anything particularly wrong-looking about the code snippet that
you showed (about setting a new font into a group box), and it should
not have caused the program to crash.
Lyle,
I’ve tried several times to isolate the problem, but it’s just so damned flaky. For example, I
can comment out entire chunks of code that don’t do anything, aren’t being called, and are
generally useless… and it makes my problem go away. Gah.
The other issue is that the app relies on my company’s entire filesystem layout.
Anyway, I’ll keep plugging away at it… I’m hell-bent on contributing in some small way to FXRuby

Jason
Jason Persampieri wrote:
Jason Persampieri wrote:
Any ideas before I work to pare the code down?
Do GC.disable and try to recreate the segfault. It might be a problem
with some of the mark/free routines in FXRuby.
Hmm… that seems to work. I guess it’s possible that disabling garbage-collection simply hid the
problem. Is there a way to log garbage collection? I could see what’s going on in the crash
scenario.
You’re right. The problem is only hidden and will resurface as soon as
you enable GC.
I don’t know of an easy way to log GC, but you could do something like this:
GC.disable
while program running
do some work
puts “did something”
GC.enable
GC.start
GC.disable
end
This might at least narrow down which library call was causing the
problem, if you can make “some work” narrow enough and make “did
something” fairly descriptive.
···
— Joel VanderWerf vjoel@PATH.Berkeley.EDU wrote:
Hmm… that seems to work. I guess it’s possible that disabling garbage-collection simply hid
the
problem. Is there a way to log garbage collection? I could see what’s going on in the crash
scenario.
You’re right. The problem is only hidden and will resurface as soon as
you enable GC.
Woot! I’ve narrowed the problem down to a single line.
Within this code:
thisGroupBox = FXGroupBox.new(@paramFrame, groupString, LAYOUT_FILL_X|FRAME_RIDGE)
thisGroupBox.setFont(FXFont.new(getApp(), “helvetica”, 12))
thisGroupBox.create
if the second line (the setFont line) is commented out, the app doesn’t crash. Looking at this, I
guess I’d be better off creating a font earlier and just referencing it here. Hmmmm…
Thanks for your help, Joel!
Jason