fxruby icon indicating copy to clipboard operation
fxruby copied to clipboard

Crash on Fox::FXApp#exit

Open cescue opened this issue 5 years ago • 1 comments

Hello,

I've been learning FXRuby and I've been having issues with interpreter crashes when calling Fox::FXApp#exit. I don't believe the issue is with the code I'm using, as it's directly from the book FXRuby: Create Lean and Mean GUIs with Ruby, and I haven't been able to find similar issues people have had with this code before.

  • Platform: Windows 10
  • Ruby version: 2.4 (64-bit)
  • FXRuby version: 1.6.40

Here's a minimal example of such behavior:

require 'fox16'

include Fox

class Application < FXMainWindow
  def initialize(app)
    super(app, 'Exit Crash Demo', width: 600, height: 400)

    menu_bar = FXMenuBar.new(
      self,
      LAYOUT_SIDE_TOP | LAYOUT_FILL_X
    )

    file_menu = FXMenuPane.new(self)

    FXMenuTitle.new(menu_bar, 'File', popupMenu: file_menu)

    exit_cmd = FXMenuCommand.new(file_menu, 'Exit')

    # `app.exit` and `exit` both result in the same behavior
    exit_cmd.connect(SEL_COMMAND) { app.exit }
  end

  def create
    super

    show(PLACEMENT_SCREEN)
  end
end

FXApp.new do |app|
  Application.new(app)
  app.create
  app.run
end

The behavior I'm experiencing can be reproduced by running the script, opening the "file" menu, and clicking "exit". In Ubuntu, this correctly closes the application (as far as I can tell; if the interpreter is crashing, it's doing so silently). In Windows, the application window closes, but is shortly followed by this message:

image

Judging by other issues in the tracker, this could be an issue with garbage collection, but I'm unsure how to further proceed. Is this a known issue, or is there any more information I can provide?

Apologies if this counts as a duplicate of #34 - I didn't want to necro it on the off-chance the underlying causes differ.

cescue avatar Apr 04 '19 22:04 cescue

Also of note: I can't reproduce this issue with ruby 2.3 or 2.5.

cescue avatar Apr 04 '19 23:04 cescue