sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    WebDialog Closes Mysteriously

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 4 Posters 932 Views 4 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.
    • J Offline
      Jim
      last edited by

      I had to clear out my Plugins folder, but the problem went away.

      I'll post if I find anything.

      Hi

      1 Reply Last reply Reply Quote 0
      • W Offline
        Whaat
        last edited by

        I had this problem until I made my web dialog objects global.

        SketchUp Plugins for Professionals

        1 Reply Last reply Reply Quote 0
        • AdamBA Offline
          AdamB
          last edited by

          @whaat said:

          I had this problem until I made my web dialog objects global.

          I could totally believe thats the problem. ie Ruby (correctly) garbage collects when it goes out of scope.

          Developer of LightUp Click for website

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            Yes, but the problem goes away if I clear the Plugins folder, and load only this code.

            I don't understand how the scope is the reason. If that were so, wouldn't many other plugins go out of scope and not work?

            Hi

            1 Reply Last reply Reply Quote 0
            • tbdT Offline
              tbd
              last edited by

              name clashing? search for other plugins with create_dialog, dlg.
              maybe there is a conflict somewhere.

              or you can add plugin by plugin and see the offending one

              SketchUp Ruby Consultant | Podium 1.x developer
              http://plugins.ro

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by

                @unknownuser said:

                name clashing? search for other plugins with create_dialog, dlg.
                maybe there is a conflict somewhere.

                or you can add plugin by plugin and see the offending one

                Thanks for the comments.

                I replaced all occurrences of "jitter" with "shake", but it still happens. I recursively grep'd through the Plugins folder for "shake", and mine is the only occurrence.

                My latest custom toolbars plugin is one that causes the problem. However, it can't be Whaat's problem because no one else has this plugin yet. My toolbars plugin reads a text file, loads a file, and creates Toolbar objects.

                Here's an example "command" file:

                
                cmd = UI;;Command.new("Arc") { Sketchup.send_action "selectArcTool;" }
                cmd.large_icon = "../images/arc_lg.png"
                cmd.small_icon = "../images/arc_sm.png"
                cmd.tooltip = "Arc"
                cmd.status_bar_text = "Draw arcs"
                cmd.menu_text = "Arc"
                cmd.set_validation_proc { tool_validation_proc("ArcTool") }
                @cmd = cmd
                
                

                and here's a simpified example of how I am loading it:

                
                ruby_files.each do |file|
                  load file
                  toolbar.add_item @cmd
                end
                
                

                See any problems here? The plugin is not ready for the public, but I can share it if anyone wants to have a look for any problems.

                Hi

                1 Reply Last reply Reply Quote 0
                • tbdT Offline
                  tbd
                  last edited by

                  Jim: I can take a look, if you want, and see if it shows the same behaviour here

                  SketchUp Ruby Consultant | Podium 1.x developer
                  http://plugins.ro

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    Jim
                    last edited by

                    @unknownuser said:

                    Jim: I can take a look, if you want, and see if it shows the same behaviour here

                    I've sent the plugin in a PM, thank you.

                    Hi

                    1 Reply Last reply Reply Quote 0
                    • AdamBA Offline
                      AdamB
                      last edited by

                      @jim said:

                      Yes, but the problem goes away if I clear the Plugins folder, and load only this code.

                      I don't understand how the scope is the reason. If that were so, wouldn't many other plugins go out of scope and not work?

                      Sure, but in doing so you're changing the character of garbage collection.

                      My hunch (based on nothing) is that the schema handler stuff (ie skp:blah) just expects the dialog to stay in scope although its an asynchronous process. Your code exits the block and does other stuff, 256 opcodes later (yes, I saw it in the Ruby source code - ouch!) the GC kicks in and sweeps it away. The javascript side then gets its knickers in a twist because the Ruby side dialog that was consuming data has disappeared.

                      Adam

                      Developer of LightUp Click for website

                      1 Reply Last reply Reply Quote 0
                      • J Offline
                        Jim
                        last edited by

                        Thanks for the comments, everyone; and especially to TBD.

                        It seems obvious now, but the variable that is referencing the dialog is local to the method. When the method is finished, so is everything else in the same scope. And so sooner or later the variable will get cleaned up by Ruby's garbage collection, and the dialog "mysteriously" goes away. So for the code I posted, a global variable will solve the problem. You could also use an instance variable.

                        Please, correct any mis-understandings I have about what's happening.

                        Hi

                        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