sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Observer bugsplat - Anyone got ideas?

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 2 Posters 213 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thomthomT Offline
      thomthom
      last edited by

      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:

      1. Start Sketchup.
      2. Create some geometry.
      3. Delete some of the geometry you created.
      4. File -> New (nothing happens)
      5. 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
      end

      class 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
        end
      

      end

      class TT_EntitiesObserver < Sketchup::EntitiesObserver
      # ...
      end
      end

      unless 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.


      tt_debug.rb

      Thomas Thomassen β€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        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.

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          Even occurs on clean SU6.

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            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.

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              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!

              Thomas Thomassen β€” SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                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.

                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  That is output to the ruby console everytime you open a new model?

                  (sorry, observers are still foreign to me)

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    @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.

                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    Buy SketchPlus
                    Buy SUbD
                    Buy WrapR
                    Buy eBook
                    Buy Modelur
                    Buy Vertex Tools
                    Buy SketchCuisine
                    Buy FormFonts

                    Advertisement