Jump to content

Error on dispose of control that is not added to a panel


blondegeek
 Share

Recommended Posts

In this playground example, I create and dispose a simple slider, without attaching the slider to a control panel. This produces an error because this._host (where the attached control panel is referenced) is not defined (see controls.ts line 1364). Should line 1364 first check if this._host is defined?

For context, this error has come up for because I have sliders that are only visible and attached to a control panel when the relevant mesh that they control is selected but the mesh they control can be deleted even if not selected. I can provide more details if considered relevant.

Thanks very much!

Link to comment
Share on other sites

  • 2 weeks later...

I think you are correct, if you want to be able to dispose controls that have never been added to a texture and hence _link()... never called:

if (this._host) {
    var index = this._host._linkedControls.indexOf(this);
    if (index > -1) {
        this.linkWithMesh(null);
    }
}

You could always do a Github pull request :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...