Narrowed Crash to Running GC in a separate thread while MessageBox is shown

View: New views
1 Messages — Rating Filter:   Alert me  

Narrowed Crash to Running GC in a separate thread while MessageBox is shown

by Melton, Ryan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Here is an updated version of the code that causes the crash.  Using ddd I narrowed the crash to the garbage collector running while the MessageBox is shown.  This simpler example simply calls GC.start in a separate thread, and will crash it every time on the second occurance of the GC running.  Something is apparently getting garbage collected that shouldn’t be.

Ryan

 

require 'rubygems'

require 'fox16'

include Fox

 

require 'thread'

 

class CrashMe < FXMainWindow

 

  def initialize (app, title)

    # Call the base class initializer first

    super(app, title)

 

    # Create a Vertical Frame for the application's contents

    @frame = FXVerticalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN)

   

    button = FXButton.new(@frame, "Press Me").connect(SEL_COMMAND, method(:handle_button_1))

 

  end

 

  def handle_button_1 (sender, sel, data)

    Thread.new do

      loop_count = 1

      loop do

        STDOUT.puts "Running GC #{loop_count}"

        GC.start

        loop_count += 1

      end

    end

    FXMessageBox.warning(self, MBOX_OK, 'Warning!', 'Are you sure?')

  end

 

  def run_gc (sender, sel, data)

    GC.start

  end

 

  def self.run

    # Make application

    application = FXApp.new("NA", "NA")

 

    # Make window

    window = self.new(application, "Title")

    window.show

   

    # Create the application windows

    application.create

   

    # Run the application

    application.run   

  end # def self.run

 

end # class CrashMe

 

CrashMe.run


This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users