SketchUp / api-issue-tracker

Public issue tracker for the SketchUp and LayOut's APIs
https://developer.sketchup.com/
38 stars 10 forks source link

Printing to ruby console or issuing UI.messagebox in AppObserver.onNewModel produces bugsplat #1006

Open agilmartin opened 1 month ago

agilmartin commented 1 month ago

The issue occurs when observer AppObserver is attached to the Sketchup and the method onNewModel prints to console or issue an UI.messagebox. After drawing to the model and then selecting File-> New from the menu, the Sketchup produces a bugsplat. The bugsplating doesn't happen every time, but after repeating the steps several times it happens sooner or later. The issue only happens in Sketchup 2024 and not in 2023 and earlier versions.

  1. SketchUp/LayOut Version: 24.0.594 x64
  2. OS Platform: Windows

Steps to reproduce.

  1. Attach an AppObserver obesrver to Sketchup:
    class MyAppObserver < Sketchup::AppObserver
    def onNewModel(model)
    puts "onNewModel called"
    end
    end
    Sketchup.add_observer(MyAppObserver.new)

    or

class MyAppObserver < Sketchup::AppObserver
  def onNewModel(model)
    UI.messagebox("onNewModel called", MB_OK)
  end
end
Sketchup.add_observer(MyAppObserver.new)
  1. Open ruby console
  2. Open default tray
  3. Open Tags section in Default tray
  4. Draw something in the model (a rectangle, circle, etc.)
  5. Select File->New from the menu
  6. Repeat 5. and 6.

Sooner or later, the Sketchup will bugsplat.

Workaround

Wrapping the code in onNewModel in seems to prevent bugsplats:

class MyAppObserver < Sketchup::AppObserver
  def onNewModel(model)
    UI.start_timer(0, false) { UI.messagebox("onNewModel called", MB_OK) }
  end
end
sketchup[bot] commented 2 weeks ago

Logged as: SKEXT-4338