FXRuby Segmentation fault

I am getting this error.
I see on the forum more people had the error, but I can’t find a
solution.

The error occurs in debug mode (via Netbeans) but also from the command
line (debug or not)

[BUG] Segmentation fault
ruby 1.8.6. <2007-03-13> [i386-mswin32]

The error points to this ruby line.

C:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.6.13-mswin32/lib/fox16/kwargs.rb:1689:
[BUG] Segmentation fault
ruby 1.8.6 (2007-03-13) [i386-mswin32]

In addition to the above post;

I am on a windows/xp system.
I downloaded all the lastest version of the gems.

The error message I get is;

[BUG] Segmentation fault
ruby 1.8.6. <2007-03-13> [i386-mswin32]

It seems to be in calls to FXRuby.

I can do with some help;

  • how can i debug errors like this?
  • how can I get better error messages when using FXRuby

Searching for this error I found several posts, but none holds a
solution.

Thanks for your help,

Ernst

-------- Original-Nachricht --------

Datum: Sun, 9 Dec 2007 23:57:10 +0900
Von: Ernst T. [email protected]
An: [email protected]
Betreff: Re: FXRuby Segmentation fault

It seems to be in calls to FXRuby.
Thanks for your help,

Ernst


Posted via http://www.ruby-forum.com/.

Dear Ernst,

I am not an FXRuby expert either, but most of my segmentation fault
errors (and all those I could reproduce) were produced when I tried to
use something from inside of
something else where the “something else” wasn’t yet defined
(as Ruby allows you to create things on the fly which Fox and thus
C doesn’t without previous declaration).

So to test whether there is really something wrong with your
installation,
I’d try to run the test scripts that come with the FXRuby installation.

If you are not getting any errors there (save for non-installed
dependencies), maybe you post (a simplified / shortened version of) your
code to the FXRuby list. There is also a GUI builder for FXRuby from
here:

http://fox-tool.rubyforge.org .

Best regards,

Axel

Ernst T. wrote:

I have proof that the error reproduces itself on a non-consistent
bases.

  • One time program runs perfectly.
  • make non essential change; like I add a line x = " "
  • next time program does not run and gives the above mentioned errors.
  • remove of line --> still errors

Symptoms like this sometimes mean there is a memory management problem
(possibly somewhere in fxruby). It might mean that an object is being
freed even though there is a reference to it. Try doing this somewhere
early in your program:

GC.disable

If you do that, the program will consume increasing amounts of memory,
so it is not a solution to the problem. But if the crash does not
happen, then that probably indicates a memory management bug of some
kind.

The source of the problem may be hard to find. You can insert GC.start
after creating objects (remove the GC.disable first). This may help
determine which allocation is the culprit. (Someone suggested a ruby
option to tell GC to collect frequently, which would help, but AFAIK
this doesn’t exist yet.)

Also, you can try to cut your program down to the smallest example in
which the bug still happens.

Thanks Axel for your reply.

Still working on the errors.

I am also getting;

This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application’s support team for more information.

Exit code: -1073741819

I have proof that the error reproduces itself on a non-consistent
bases.

  • One time program runs perfectly.
  • make non essential change; like I add a line x = " "
  • next time program does not run and gives the above mentioned errors.
  • remove of line --> still errors

Joel VanderWerf wrote:

GC.disable

Thanks Joel (dankjewel)

I tried GC.disable and GC.enable and GC.start
No difference; sometimes the program runs, sometimes not.

Debuging and minimizing the program by placing comments is giving
non-consistent results. It seems not to be a specific line in my code
which causes the error.

I am working with the lasted Gems, tried to execute the program from the
command line and from Netbeans and Scite. no difference. all the same
none-consistent results.

This is a tough one.

Ernst

Found another little clue

@bs_tab = [“Buy”, “Sell”]
@bs = -1
unless @horizontalframe41
FX::HorizontalFrame.new(@horizontalframe4){|w|
@horizontalframe41=w
w.wdg_name=‘horizontalframe41’
w.backColor=Fox::FXRGBA(0,0,0,255)}
FX::ComboBox.new(@horizontalframe41){|w|
@w_bs=w
w.wdg_name=‘w_bs’
w.fillItems(@bs_tab)
w.backColor=Fox::FXRGBA(0,0,0,255)
w.textColor=Fox::FXRGBA(0,255,0,255)}
@horizontalframe41.create
end
@w_bs.currentItem = 0 if @bs == 1
@w_bs.currentItem = 1 if @bs == -1

It seems that the "w.fillItems(@bs_tab) is the cause of many of my
errors.

"This application has requested the Runtime to terminate it in an
unusual
way.
Please contact the application’s support team for more information.

Exit code: -1073741819"

On Dec 10, 2007 9:32 AM, Ernst T. [email protected] wrote:

        @w_bs=w

errors.
What is @bs_tab? It should be an array of strings. See what happens if
you replace the line:

w.fillItems(@bs_tab)

with this:

@bs_tab.each { |s| w.appendItem(s) }

Hope this helps,

Lyle

Lyle J. wrote:

What is @bs_tab? It should be an array of strings. See what happens if
you replace the line:

w.fillItems(@bs_tab)

@bs_tab is an array filled with two elements. [“Buy”, “Sell”]

Your suggestion make a world of difference.
It seems that the fillItems is not as robust as it could be.

appendItem is doing the trick.

Thanks,
Ernst

P.s. I am need for your book, spending to much time puzzling.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs