api-issue-tracker icon indicating copy to clipboard operation
api-issue-tracker copied to clipboard

SketchUp crashes on quit when using Sketchup.send_action in html dialog on_close event

Open valdemar opened this issue 1 year ago • 4 comments

Tested on SketchUp 2024 on Windows.

SketchUp crashes when the user quits if a HtmlDialog is open that has a on_closed event handler that calls Sketchup.send_action

Paste the following code snippet into the ruby console and then quit SketchUp to reproduce:

module TestingDialog

  def self.show
    @dialog = UI::HtmlDialog.new(
      dialog_title: 'SketchUp Crasher',
      style: UI::HtmlDialog::STYLE_DIALOG
    )
    @dialog.set_on_closed do
      Sketchup.send_action('selectSelectionTool:')
    end
    @dialog.show
  end

end

TestingDialog.show

valdemar avatar Apr 15 '24 12:04 valdemar

Did you test on any earlier versions?

thomthom avatar Apr 16 '24 08:04 thomthom

Did you test on any earlier versions?

No, not yet. I only have SketchUp 2024 installed at the moment.

I discovered that a solution is to use Sketchup.active_model.select_tool(nil) instead of send_action - that does not cause SketchUp to crash.

valdemar avatar Apr 16 '24 09:04 valdemar

Logged as: SKEXT-4141

sketchup[bot] avatar Apr 22 '24 06:04 sketchup[bot]

Did you test on any earlier versions?

No, not yet. I only have SketchUp 2024 installed at the moment.

I discovered that a solution is to use Sketchup.active_model.select_tool(nil) instead of send_action - that does not cause SketchUp to crash.

Thanks for the follow up.

I'd strongly recommend avoiding send_action whenever possible. It's not a stable API and it'll likely be deprecated.

thomthom avatar Apr 22 '24 08:04 thomthom