[fxruby-users] Custom SplashScreen. Seg fault when wrapped in a class

Andreas S andreas_s at hotmail.com
Wed Dec 3 20:50:47 EST 2008


Hi,

I'm writing a custom SplashScreen because I can't convey loading status with FXSplashWindow. While FXSplashScreen does that, it has that OK button to close it. I want it to close by itself when my process is done.

The following code works fine, but when it is wrapped in a class, I get segmentation fault. Did I make a mistake in the start up sequence? But the fact that it doesn't seg-fault when it is outside of a class, makes it looks like a bug to me. 

Any idea how to work around it?

-andre



require 'fox16'
include Fox

class Splash < FXDialogBox
  def action
    Thread.new do
      yield
      handle nil, FXSEL(SEL_COMMAND,ID_ACCEPT), nil
    end
  end
end

#class App                           # uncomment this to see segmentation fault
#  def self.start                    
    app = FXApp.new('a', 'b')
    splash = Splash.new app, 'splash', :width => 300, :height => 200

    splash.action do
      sleep 1          # Simulating data loading
    end
    app.create
    splash.show PLACEMENT_SCREEN
    puts "RUN"
    app.runModalWhileShown splash
    puts "Begin real"
    win = FXMainWindow.new app, 'joe', :width => 500, :height => 400
    win.show PLACEMENT_SCREEN
    win.create
    puts "App run"
    app.run
#  end
#end

#App.start

_________________________________________________________________
Suspicious message? There’s an alert for that. 
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad2_122008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081204/1299f1a3/attachment.html>


More information about the fxruby-users mailing list