Observer bugsplat - Anyone got ideas?
-
I've been trying to track down the bugsplats in my Doublecut plugin.
I've managed to isolate and reproduce the bugsplat.The code is here below as well as attached as a test file if any of you would care to test it yourself.
When I tried on my secondary, clean install, machine it didn't seem to crash as consistent as my main machine. Just do some tests. Add some geometry (maybe try to group/make component) and delete it again. Then do File -> New a couple of times. Usually that crashes it.
I've been testing this on SU7.
@unknownuser said:
=begin
How to Reproduce Bugsplat:
- Start Sketchup.
- Create some geometry.
- Delete some of the geometry you created.
- File -> New (nothing happens)
- For a second time after deleting the geometry - File -> New (Bugsplat!)
If you delete entities that was already in the model, such as Sang in the Template - or if
you opened an existing file and deleted something there - nothing happens.It only happens the second time you create a new model after you have deleted some entities
you previously created in that session.Interesting observation:
puts model.active_entities
It will return the same output (hexadecimal ID code) for the duration of that SU session. Even if
you open existing file or create new file.
I thought that was what caused the bugsplat - as I initially didn't remove the old observers. But
even when I remove the observers - and they do seem to return sucessful - SU bugsplats.=end
module TT_Debug
Variable to store the observer
@observer = nil
Accessors
def self.observer
@observer
end
def self.observer=(value)
@observer = value
endclass TT_AppObserver < Sketchup::AppObserver
def onNewModel(model) puts "\nonNewModel" # Try to remove old observer - just incase. r = model.active_entities.remove_observer(TT_Debug.observer) puts '> Removing old observer from Model: ' + r.to_s # Create new observer TT_Debug.observer = TT_EntitiesObserver.new # Output to console so we can verify the result. puts TT_Debug.observer # .active_entities appear to return the same even after new model or open model puts model.active_entities # Attach new observer r = model.active_entities.add_observer(TT_Debug.observer) #(!???) puts '> Adding Path Observer to Model: ' + r.to_s endend
class TT_EntitiesObserver < Sketchup::EntitiesObserver
# ...
end
endunless file_loaded?('tt_debug.rb')
Sketchup.add_observer(TT_Debug::TT_AppObserver.new)
end
#-----------------------------------------------------------------------------
file_loaded('tt_debug.rb')Anyone got any idea of why this happens? I find the behaviour very strange.
I really hope this one can be solved. Otherways I'm really running short of observers I can use.
-
On my second machine - this doesn't trigger the first time as it does on my main machine.
On my second machine I have to do:Open Sketchup
Draw something
Delete it
File -> New
Draw something
File -> New
File -> New
Bugsplat!
As mentioned - the second machine doesn't have any extra plugins installed.
-
Even occurs on clean SU6.
-
Same thing happens if I attach an EntityObserver to an Component. If I delete the component - SU bugsplats later when I do File -> New.
The EntityObserver doesn't even do anything.
-
I tried with Jim's Observer tests:
Created new model.
Made a component.
Attached an EntityObserver to the component
Deleted the component
File -> New x2 = Bugsplat! -
Isn't this odd?
### OBSERVE MODEL ### > Result; true - Model; #<Sketchup;;Model;0x107690f0> > .entities; #<Sketchup;;Entities;0x1076f330> - .active_entities; #<Sketchup;;Entities;0x1076f330> OnNewModel ### OBSERVE MODEL ### > Result; true - Model; #<Sketchup;;Model;0x10768d90> > .entities; #<Sketchup;;Entities;0x1076f330> - .active_entities; #<Sketchup;;Entities;0x1076f330> OnNewModel ### OBSERVE MODEL ### > Result; true - Model; #<Sketchup;;Model;0x10768a30> > .entities; #<Sketchup;;Entities;0x1076f330> - .active_entities; #<Sketchup;;Entities;0x1076f330> OnNewModel ### OBSERVE MODEL ### > Result; true - Model; #<Sketchup;;Model;0x107686d0> > .entities; #<Sketchup;;Entities;0x1076f330> - .active_entities; #<Sketchup;;Entities;0x1076f330>This is from an onOpenModel event. The Model Hex number changes. But the Entities stays put.
-
That is output to the ruby console everytime you open a new model?
(sorry, observers are still foreign to me)
-
@chris fullmer said:
That is output to the ruby console everytime you open a new model?
Yup, that last code box was console output yes.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement